@lightningjs/renderer 3.0.0-beta3 → 3.0.0-beta4
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/COPYING +1 -0
- package/LICENSE +202 -202
- package/NOTICE +3 -3
- package/README.md +147 -147
- package/dist/src/core/CoreNode.d.ts +3 -2
- package/dist/src/core/CoreNode.js +13 -7
- package/dist/src/core/CoreNode.js.map +1 -1
- package/dist/src/core/CoreTextNode.d.ts +2 -0
- package/dist/src/core/CoreTextNode.js +7 -0
- package/dist/src/core/CoreTextNode.js.map +1 -1
- package/dist/src/core/CoreTextureManager.d.ts +2 -0
- package/dist/src/core/CoreTextureManager.js +7 -5
- package/dist/src/core/CoreTextureManager.js.map +1 -1
- package/dist/src/core/Stage.d.ts +5 -0
- package/dist/src/core/Stage.js +10 -5
- package/dist/src/core/Stage.js.map +1 -1
- package/dist/src/core/lib/validateImageBitmap.d.ts +2 -1
- package/dist/src/core/lib/validateImageBitmap.js +4 -4
- package/dist/src/core/lib/validateImageBitmap.js.map +1 -1
- package/dist/src/core/platforms/Platform.d.ts +37 -0
- package/dist/src/{main-api/IRenderDriver.js → core/platforms/Platform.js} +4 -2
- package/dist/src/core/platforms/Platform.js.map +1 -0
- package/dist/src/core/platforms/web/WebPlatform.d.ts +9 -0
- package/dist/src/core/platforms/web/WebPlatform.js +58 -0
- package/dist/src/core/platforms/web/WebPlatform.js.map +1 -0
- package/dist/src/core/renderers/CoreRenderer.d.ts +3 -1
- package/dist/src/core/renderers/CoreRenderer.js.map +1 -1
- package/dist/src/core/renderers/canvas/CanvasRenderer.js.map +1 -1
- package/dist/src/core/renderers/webgl/WebGlRenderer.d.ts +3 -1
- package/dist/src/core/renderers/webgl/WebGlRenderer.js +86 -60
- package/dist/src/core/renderers/webgl/WebGlRenderer.js.map +1 -1
- package/dist/src/core/renderers/webgl/internal/ShaderUtils.js +35 -35
- package/dist/src/core/renderers/webgl/shaders/DefaultShader.js +45 -45
- package/dist/src/core/renderers/webgl/shaders/DefaultShaderBatched.js +61 -61
- package/dist/src/core/renderers/webgl/shaders/DynamicShader.js +93 -93
- package/dist/src/core/renderers/webgl/shaders/RoundedRectangle.js +63 -63
- package/dist/src/core/renderers/webgl/shaders/SdfShader.js +62 -62
- package/dist/src/core/renderers/webgl/shaders/effects/BorderBottomEffect.js +15 -15
- package/dist/src/core/renderers/webgl/shaders/effects/BorderEffect.js +6 -6
- package/dist/src/core/renderers/webgl/shaders/effects/BorderLeftEffect.js +15 -15
- package/dist/src/core/renderers/webgl/shaders/effects/BorderRightEffect.js +15 -15
- package/dist/src/core/renderers/webgl/shaders/effects/BorderTopEffect.js +15 -15
- package/dist/src/core/renderers/webgl/shaders/effects/FadeOutEffect.js +42 -42
- package/dist/src/core/renderers/webgl/shaders/effects/GlitchEffect.js +44 -44
- package/dist/src/core/renderers/webgl/shaders/effects/GrayscaleEffect.js +3 -3
- package/dist/src/core/renderers/webgl/shaders/effects/HolePunchEffect.js +22 -22
- package/dist/src/core/renderers/webgl/shaders/effects/LinearGradientEffect.js +28 -28
- package/dist/src/core/renderers/webgl/shaders/effects/RadialGradientEffect.js +10 -10
- package/dist/src/core/renderers/webgl/shaders/effects/RadialProgressEffect.js +37 -37
- package/dist/src/core/renderers/webgl/shaders/effects/RadiusEffect.js +19 -19
- package/dist/src/core/shaders/webgl/Border.js +59 -59
- package/dist/src/core/shaders/webgl/Default.js +47 -47
- package/dist/src/core/shaders/webgl/DefaultBatched.js +61 -61
- package/dist/src/core/shaders/webgl/HolePunch.js +32 -32
- package/dist/src/core/shaders/webgl/LinearGradient.js +36 -36
- package/dist/src/core/shaders/webgl/RadialGradient.js +33 -33
- package/dist/src/core/shaders/webgl/Rounded.js +71 -71
- package/dist/src/core/shaders/webgl/RoundedWithBorder.js +66 -66
- package/dist/src/core/shaders/webgl/RoundedWithBorderAndShadow.js +79 -79
- package/dist/src/core/shaders/webgl/RoundedWithShadow.js +54 -54
- package/dist/src/core/shaders/webgl/SdfShader.js +62 -62
- package/dist/src/core/shaders/webgl/Shadow.js +83 -83
- package/dist/src/core/temp.js +77 -0
- package/dist/src/core/temp.js.map +1 -0
- package/dist/src/core/text-rendering/renderers/CanvasTextRenderer.js +5 -0
- package/dist/src/core/text-rendering/renderers/CanvasTextRenderer.js.map +1 -1
- package/dist/src/core/text-rendering/renderers/LightningTextTextureRenderer.d.ts +1 -1
- package/dist/src/core/text-rendering/renderers/LightningTextTextureRenderer.js +50 -2
- package/dist/src/core/text-rendering/renderers/LightningTextTextureRenderer.js.map +1 -1
- package/dist/src/core/text-rendering/renderers/SdfTextRenderer/SdfTextRenderer.js +6 -2
- package/dist/src/core/text-rendering/renderers/SdfTextRenderer/SdfTextRenderer.js.map +1 -1
- package/dist/src/core/text-rendering/renderers/SdfTextRenderer/internal/layoutText.d.ts +1 -1
- package/dist/src/core/text-rendering/renderers/SdfTextRenderer/internal/layoutText.js +66 -8
- package/dist/src/core/text-rendering/renderers/SdfTextRenderer/internal/layoutText.js.map +1 -1
- package/dist/src/core/text-rendering/renderers/TextRenderer.d.ts +13 -0
- package/dist/src/core/text-rendering/renderers/TextRenderer.js +3 -0
- package/dist/src/core/text-rendering/renderers/TextRenderer.js.map +1 -1
- package/dist/src/core/textures/ImageTexture.d.ts +1 -0
- package/dist/src/core/textures/ImageTexture.js +5 -3
- package/dist/src/core/textures/ImageTexture.js.map +1 -1
- package/dist/src/core/textures/Texture.d.ts +9 -2
- package/dist/src/core/textures/Texture.js +18 -6
- package/dist/src/core/textures/Texture.js.map +1 -1
- package/dist/src/main-api/Renderer.d.ts +12 -0
- package/dist/src/main-api/Renderer.js +14 -2
- package/dist/src/main-api/Renderer.js.map +1 -1
- package/dist/tsconfig.dist.tsbuildinfo +1 -1
- package/exports/canvas-shaders.ts +28 -28
- package/exports/canvas.ts +45 -45
- package/exports/index.ts +90 -90
- package/exports/inspector.ts +24 -24
- package/exports/utils.ts +44 -44
- package/exports/webgl-shaders.ts +28 -28
- package/exports/webgl.ts +50 -50
- package/package.json +1 -2
- package/scripts/please-use-pnpm.js +13 -13
- package/src/common/CommonTypes.ts +146 -146
- package/src/common/EventEmitter.ts +77 -77
- package/src/common/IAnimationController.ts +92 -92
- package/src/common/IEventEmitter.ts +28 -28
- package/src/core/CoreNode.test.ts +203 -203
- package/src/core/CoreNode.ts +2494 -2486
- package/src/core/CoreShaderManager.ts +188 -188
- package/src/core/CoreTextNode.ts +448 -439
- package/src/core/CoreTextureManager.ts +601 -597
- package/src/core/Stage.ts +754 -738
- package/src/core/TextureMemoryManager.ts +395 -395
- package/src/core/animations/AnimationManager.ts +38 -38
- package/src/core/animations/CoreAnimation.ts +284 -284
- package/src/core/animations/CoreAnimationController.ts +157 -157
- package/src/core/lib/ContextSpy.ts +41 -41
- package/src/core/lib/ImageWorker.ts +280 -280
- package/src/core/lib/Matrix3d.ts +244 -244
- package/src/core/lib/RenderCoords.ts +71 -71
- package/src/core/lib/WebGlContextWrapper.ts +1374 -1374
- package/src/core/lib/textureCompression.ts +152 -152
- package/src/core/lib/textureSvg.ts +78 -78
- package/src/core/lib/utils.ts +386 -386
- package/src/core/lib/validateImageBitmap.ts +87 -76
- package/src/core/platform.ts +64 -64
- package/src/core/platforms/Platform.ts +77 -0
- package/src/core/platforms/web/WebPlatform.ts +84 -0
- package/src/core/renderers/CoreContextTexture.ts +43 -43
- package/src/core/renderers/CoreRenderOp.ts +22 -22
- package/src/core/renderers/CoreRenderer.ts +109 -107
- package/src/core/renderers/CoreShaderNode.ts +165 -165
- package/src/core/renderers/CoreShaderProgram.ts +23 -23
- package/src/core/renderers/canvas/CanvasRenderer.ts +298 -298
- package/src/core/renderers/canvas/CanvasShaderNode.ts +99 -99
- package/src/core/renderers/canvas/CanvasTexture.ts +156 -156
- package/src/core/renderers/canvas/internal/C2DShaderUtils.ts +220 -220
- package/src/core/renderers/canvas/internal/ColorUtils.ts +85 -85
- package/src/core/renderers/webgl/WebGlCtxRenderTexture.ts +86 -86
- package/src/core/renderers/webgl/WebGlCtxSubTexture.ts +50 -50
- package/src/core/renderers/webgl/WebGlCtxTexture.ts +301 -301
- package/src/core/renderers/webgl/WebGlRenderOp.ts +161 -161
- package/src/core/renderers/webgl/WebGlRenderer.ts +750 -720
- package/src/core/renderers/webgl/WebGlShaderNode.ts +437 -437
- package/src/core/renderers/webgl/WebGlShaderProgram.ts +318 -318
- package/src/core/renderers/webgl/internal/BufferCollection.ts +54 -54
- package/src/core/renderers/webgl/internal/RendererUtils.ts +155 -155
- package/src/core/renderers/webgl/internal/ShaderUtils.ts +281 -281
- package/src/core/renderers/webgl/internal/WebGlUtils.ts +35 -35
- package/src/core/shaders/canvas/Border.ts +78 -78
- package/src/core/shaders/canvas/HolePunch.ts +62 -62
- package/src/core/shaders/canvas/LinearGradient.ts +69 -69
- package/src/core/shaders/canvas/RadialGradient.ts +113 -113
- package/src/core/shaders/canvas/Rounded.ts +55 -55
- package/src/core/shaders/canvas/RoundedWithBorder.ts +68 -68
- package/src/core/shaders/canvas/RoundedWithBorderAndShadow.ts +88 -88
- package/src/core/shaders/canvas/RoundedWithShadow.ts +69 -69
- package/src/core/shaders/canvas/Shadow.ts +52 -52
- package/src/core/shaders/canvas/utils/render.ts +151 -151
- package/src/core/shaders/templates/BorderTemplate.ts +115 -115
- package/src/core/shaders/templates/HolePunchTemplate.ts +82 -82
- package/src/core/shaders/templates/LinearGradientTemplate.ts +71 -71
- package/src/core/shaders/templates/RadialGradientTemplate.ts +81 -81
- package/src/core/shaders/templates/RoundedTemplate.ts +98 -98
- package/src/core/shaders/templates/RoundedWithBorderAndShadowTemplate.ts +38 -38
- package/src/core/shaders/templates/RoundedWithBorderTemplate.ts +35 -35
- package/src/core/shaders/templates/RoundedWithShadowTemplate.ts +35 -35
- package/src/core/shaders/templates/ShadowTemplate.ts +106 -106
- package/src/core/shaders/templates/shaderUtils.ts +47 -47
- package/src/core/shaders/webgl/Border.ts +96 -96
- package/src/core/shaders/webgl/Default.ts +89 -89
- package/src/core/shaders/webgl/DefaultBatched.ts +129 -129
- package/src/core/shaders/webgl/HolePunch.ts +78 -78
- package/src/core/shaders/webgl/LinearGradient.ts +81 -81
- package/src/core/shaders/webgl/RadialGradient.ts +84 -84
- package/src/core/shaders/webgl/Rounded.ts +117 -117
- package/src/core/shaders/webgl/RoundedWithBorder.ts +114 -114
- package/src/core/shaders/webgl/RoundedWithBorderAndShadow.ts +133 -133
- package/src/core/shaders/webgl/RoundedWithShadow.ts +98 -98
- package/src/core/shaders/webgl/SdfShader.ts +134 -134
- package/src/core/shaders/webgl/Shadow.ts +115 -115
- package/src/core/text-rendering/TextRenderingUtils.ts +36 -36
- package/src/core/text-rendering/TextTextureRendererUtils.ts +263 -263
- package/src/core/text-rendering/TrFontManager.ts +183 -183
- package/src/core/text-rendering/font-face-types/SdfTrFontFace/SdfTrFontFace.ts +176 -176
- package/src/core/text-rendering/font-face-types/SdfTrFontFace/internal/FontShaper.ts +139 -139
- package/src/core/text-rendering/font-face-types/SdfTrFontFace/internal/SdfFontShaper.test.ts +173 -173
- package/src/core/text-rendering/font-face-types/SdfTrFontFace/internal/SdfFontShaper.ts +171 -171
- package/src/core/text-rendering/font-face-types/TrFontFace.ts +187 -187
- package/src/core/text-rendering/font-face-types/WebTrFontFace.ts +94 -94
- package/src/core/text-rendering/font-face-types/utils.ts +39 -39
- package/src/core/text-rendering/renderers/CanvasTextRenderer.ts +514 -509
- package/src/core/text-rendering/renderers/LightningTextTextureRenderer.ts +863 -815
- package/src/core/text-rendering/renderers/SdfTextRenderer/SdfTextRenderer.ts +846 -840
- package/src/core/text-rendering/renderers/SdfTextRenderer/internal/PeekableGenerator.test.ts +48 -48
- package/src/core/text-rendering/renderers/SdfTextRenderer/internal/PeekableGenerator.ts +66 -66
- package/src/core/text-rendering/renderers/SdfTextRenderer/internal/SpecialCodepoints.ts +52 -52
- package/src/core/text-rendering/renderers/SdfTextRenderer/internal/constants.ts +32 -32
- package/src/core/text-rendering/renderers/SdfTextRenderer/internal/getStartConditions.ts +117 -117
- package/src/core/text-rendering/renderers/SdfTextRenderer/internal/getUnicodeCodepoints.test.ts +133 -133
- package/src/core/text-rendering/renderers/SdfTextRenderer/internal/getUnicodeCodepoints.ts +38 -38
- package/src/core/text-rendering/renderers/SdfTextRenderer/internal/layoutText.ts +497 -408
- package/src/core/text-rendering/renderers/SdfTextRenderer/internal/measureText.test.ts +49 -49
- package/src/core/text-rendering/renderers/SdfTextRenderer/internal/measureText.ts +52 -52
- package/src/core/text-rendering/renderers/SdfTextRenderer/internal/setRenderWindow.test.ts +205 -205
- package/src/core/text-rendering/renderers/SdfTextRenderer/internal/setRenderWindow.ts +93 -93
- package/src/core/text-rendering/renderers/SdfTextRenderer/internal/util.ts +40 -40
- package/src/core/text-rendering/renderers/TextRenderer.ts +567 -550
- package/src/core/textures/ColorTexture.ts +102 -102
- package/src/core/textures/ImageTexture.ts +410 -399
- package/src/core/textures/NoiseTexture.ts +104 -104
- package/src/core/textures/RenderTexture.ts +85 -85
- package/src/core/textures/SubTexture.ts +205 -205
- package/src/core/textures/Texture.ts +358 -337
- package/src/core/utils.ts +227 -227
- package/src/env.d.ts +7 -7
- package/src/main-api/INode.ts +100 -100
- package/src/main-api/Inspector.ts +522 -522
- package/src/main-api/Renderer.ts +675 -649
- package/src/main-api/utils.ts +45 -45
- package/src/utils.ts +267 -267
- package/dist/exports/core-api.d.ts +0 -74
- package/dist/exports/core-api.js +0 -96
- package/dist/exports/core-api.js.map +0 -1
- package/dist/exports/main-api.d.ts +0 -30
- package/dist/exports/main-api.js +0 -45
- package/dist/exports/main-api.js.map +0 -1
- package/dist/src/core/CoreExtension.d.ts +0 -12
- package/dist/src/core/CoreExtension.js +0 -29
- package/dist/src/core/CoreExtension.js.map +0 -1
- package/dist/src/core/CoreStuff.js +0 -138
- package/dist/src/core/CoreStuff.js.map +0 -1
- package/dist/src/core/CoreTexturizer.d.ts +0 -14
- package/dist/src/core/CoreTexturizer.js +0 -47
- package/dist/src/core/CoreTexturizer.js.map +0 -1
- package/dist/src/core/LngNode.d.ts +0 -736
- package/dist/src/core/LngNode.js +0 -1174
- package/dist/src/core/LngNode.js.map +0 -1
- package/dist/src/core/Matrix2DContext.d.ts +0 -15
- package/dist/src/core/Matrix2DContext.js +0 -45
- package/dist/src/core/Matrix2DContext.js.map +0 -1
- package/dist/src/core/ShaderNode.d.ts +0 -10
- package/dist/src/core/ShaderNode.js +0 -30
- package/dist/src/core/ShaderNode.js.map +0 -1
- package/dist/src/core/TextNode.d.ts +0 -103
- package/dist/src/core/TextNode.js +0 -331
- package/dist/src/core/TextNode.js.map +0 -1
- package/dist/src/core/lib/Coords.d.ts +0 -14
- package/dist/src/core/lib/Coords.js +0 -55
- package/dist/src/core/lib/Coords.js.map +0 -1
- package/dist/src/core/lib/glm/common.d.ts +0 -162
- package/dist/src/core/lib/glm/common.js +0 -81
- package/dist/src/core/lib/glm/common.js.map +0 -1
- package/dist/src/core/lib/glm/index.d.ts +0 -11
- package/dist/src/core/lib/glm/index.js +0 -30
- package/dist/src/core/lib/glm/index.js.map +0 -1
- package/dist/src/core/lib/glm/mat2.d.ts +0 -219
- package/dist/src/core/lib/glm/mat2.js +0 -396
- package/dist/src/core/lib/glm/mat2.js.map +0 -1
- package/dist/src/core/lib/glm/mat2d.d.ts +0 -237
- package/dist/src/core/lib/glm/mat2d.js +0 -442
- package/dist/src/core/lib/glm/mat2d.js.map +0 -1
- package/dist/src/core/lib/glm/mat3.d.ts +0 -283
- package/dist/src/core/lib/glm/mat3.js +0 -680
- package/dist/src/core/lib/glm/mat3.js.map +0 -1
- package/dist/src/core/lib/glm/mat4.d.ts +0 -550
- package/dist/src/core/lib/glm/mat4.js +0 -1802
- package/dist/src/core/lib/glm/mat4.js.map +0 -1
- package/dist/src/core/lib/glm/quat.d.ts +0 -363
- package/dist/src/core/lib/glm/quat.js +0 -693
- package/dist/src/core/lib/glm/quat.js.map +0 -1
- package/dist/src/core/lib/glm/quat2.d.ts +0 -356
- package/dist/src/core/lib/glm/quat2.js +0 -754
- package/dist/src/core/lib/glm/quat2.js.map +0 -1
- package/dist/src/core/lib/glm/vec2.d.ts +0 -365
- package/dist/src/core/lib/glm/vec2.js +0 -569
- package/dist/src/core/lib/glm/vec2.js.map +0 -1
- package/dist/src/core/lib/glm/vec3.d.ts +0 -406
- package/dist/src/core/lib/glm/vec3.js +0 -720
- package/dist/src/core/lib/glm/vec3.js.map +0 -1
- package/dist/src/core/lib/glm/vec4.d.ts +0 -330
- package/dist/src/core/lib/glm/vec4.js +0 -608
- package/dist/src/core/lib/glm/vec4.js.map +0 -1
- package/dist/src/core/renderers/CoreShaderManager.d.ts +0 -19
- package/dist/src/core/renderers/CoreShaderManager.js +0 -33
- package/dist/src/core/renderers/CoreShaderManager.js.map +0 -1
- package/dist/src/core/renderers/webgl/WebGlCoreShaderManager.d.ts +0 -27
- package/dist/src/core/renderers/webgl/WebGlCoreShaderManager.js +0 -82
- package/dist/src/core/renderers/webgl/WebGlCoreShaderManager.js.map +0 -1
- package/dist/src/core/renderers/webgl/WebGlCoreShaderProgram.d.ts +0 -11
- package/dist/src/core/renderers/webgl/WebGlCoreShaderProgram.js +0 -34
- package/dist/src/core/renderers/webgl/WebGlCoreShaderProgram.js.map +0 -1
- package/dist/src/core/scene/Scene.d.ts +0 -59
- package/dist/src/core/scene/Scene.js +0 -106
- package/dist/src/core/scene/Scene.js.map +0 -1
- package/dist/src/core/text-rendering/renderers/SdfTextRenderer/internal/makeRenderWindow.d.ts +0 -20
- package/dist/src/core/text-rendering/renderers/SdfTextRenderer/internal/makeRenderWindow.js +0 -55
- package/dist/src/core/text-rendering/renderers/SdfTextRenderer/internal/makeRenderWindow.js.map +0 -1
- package/dist/src/main-api/ICoreDriver.d.ts +0 -27
- package/dist/src/main-api/ICoreDriver.js +0 -20
- package/dist/src/main-api/ICoreDriver.js.map +0 -1
- package/dist/src/main-api/IRenderDriver.d.ts +0 -20
- package/dist/src/main-api/IRenderDriver.js.map +0 -1
- package/dist/src/main-api/IShaderController.d.ts +0 -14
- package/dist/src/main-api/IShaderController.js +0 -30
- package/dist/src/main-api/IShaderController.js.map +0 -1
- package/dist/src/main-api/IShaderNode.d.ts +0 -17
- package/dist/src/main-api/IShaderNode.js +0 -19
- package/dist/src/main-api/IShaderNode.js.map +0 -1
- package/dist/src/main-api/RendererMain.d.ts +0 -375
- package/dist/src/main-api/RendererMain.js +0 -365
- package/dist/src/main-api/RendererMain.js.map +0 -1
- package/dist/src/main-api/texture-usage-trackers/FinalizationRegistryTextureUsageTracker.d.ts +0 -9
- package/dist/src/main-api/texture-usage-trackers/FinalizationRegistryTextureUsageTracker.js +0 -38
- package/dist/src/main-api/texture-usage-trackers/FinalizationRegistryTextureUsageTracker.js.map +0 -1
- package/dist/src/main-api/texture-usage-trackers/ManualCountTextureUsageTracker.d.ts +0 -56
- package/dist/src/main-api/texture-usage-trackers/ManualCountTextureUsageTracker.js +0 -101
- package/dist/src/main-api/texture-usage-trackers/ManualCountTextureUsageTracker.js.map +0 -1
- package/dist/src/main-api/texture-usage-trackers/TextureUsageTracker.d.ts +0 -32
- package/dist/src/main-api/texture-usage-trackers/TextureUsageTracker.js +0 -28
- package/dist/src/main-api/texture-usage-trackers/TextureUsageTracker.js.map +0 -1
- package/dist/src/render-drivers/main/MainCoreDriver.d.ts +0 -24
- package/dist/src/render-drivers/main/MainCoreDriver.js +0 -118
- package/dist/src/render-drivers/main/MainCoreDriver.js.map +0 -1
- package/dist/src/render-drivers/main/MainOnlyNode.d.ts +0 -99
- package/dist/src/render-drivers/main/MainOnlyNode.js +0 -396
- package/dist/src/render-drivers/main/MainOnlyNode.js.map +0 -1
- package/dist/src/render-drivers/main/MainOnlyShaderController.d.ts +0 -6
- package/dist/src/render-drivers/main/MainOnlyShaderController.js +0 -15
- package/dist/src/render-drivers/main/MainOnlyShaderController.js.map +0 -1
- package/dist/src/render-drivers/main/MainOnlyShaderNode.d.ts +0 -7
- package/dist/src/render-drivers/main/MainOnlyShaderNode.js +0 -34
- package/dist/src/render-drivers/main/MainOnlyShaderNode.js.map +0 -1
- package/dist/src/render-drivers/main/MainOnlyTextNode.d.ts +0 -47
- package/dist/src/render-drivers/main/MainOnlyTextNode.js +0 -205
- package/dist/src/render-drivers/main/MainOnlyTextNode.js.map +0 -1
- package/dist/src/render-drivers/main/MainRenderDriver.d.ts +0 -17
- package/dist/src/render-drivers/main/MainRenderDriver.js +0 -88
- package/dist/src/render-drivers/main/MainRenderDriver.js.map +0 -1
- package/dist/src/render-drivers/threadx/NodeStruct.d.ts +0 -90
- package/dist/src/render-drivers/threadx/NodeStruct.js +0 -281
- package/dist/src/render-drivers/threadx/NodeStruct.js.map +0 -1
- package/dist/src/render-drivers/threadx/SharedNode.d.ts +0 -39
- package/dist/src/render-drivers/threadx/SharedNode.js +0 -60
- package/dist/src/render-drivers/threadx/SharedNode.js.map +0 -1
- package/dist/src/render-drivers/threadx/TextNodeStruct.d.ts +0 -44
- package/dist/src/render-drivers/threadx/TextNodeStruct.js +0 -201
- package/dist/src/render-drivers/threadx/TextNodeStruct.js.map +0 -1
- package/dist/src/render-drivers/threadx/ThreadXCoreDriver.d.ts +0 -28
- package/dist/src/render-drivers/threadx/ThreadXCoreDriver.js +0 -234
- package/dist/src/render-drivers/threadx/ThreadXCoreDriver.js.map +0 -1
- package/dist/src/render-drivers/threadx/ThreadXMainAnimationController.d.ts +0 -20
- package/dist/src/render-drivers/threadx/ThreadXMainAnimationController.js +0 -84
- package/dist/src/render-drivers/threadx/ThreadXMainAnimationController.js.map +0 -1
- package/dist/src/render-drivers/threadx/ThreadXMainNode.d.ts +0 -44
- package/dist/src/render-drivers/threadx/ThreadXMainNode.js +0 -154
- package/dist/src/render-drivers/threadx/ThreadXMainNode.js.map +0 -1
- package/dist/src/render-drivers/threadx/ThreadXMainShaderController.d.ts +0 -6
- package/dist/src/render-drivers/threadx/ThreadXMainShaderController.js +0 -16
- package/dist/src/render-drivers/threadx/ThreadXMainShaderController.js.map +0 -1
- package/dist/src/render-drivers/threadx/ThreadXMainShaderNode.d.ts +0 -7
- package/dist/src/render-drivers/threadx/ThreadXMainShaderNode.js +0 -15
- package/dist/src/render-drivers/threadx/ThreadXMainShaderNode.js.map +0 -1
- package/dist/src/render-drivers/threadx/ThreadXMainTextNode.d.ts +0 -28
- package/dist/src/render-drivers/threadx/ThreadXMainTextNode.js +0 -55
- package/dist/src/render-drivers/threadx/ThreadXMainTextNode.js.map +0 -1
- package/dist/src/render-drivers/threadx/ThreadXRenderDriver.d.ts +0 -21
- package/dist/src/render-drivers/threadx/ThreadXRenderDriver.js +0 -198
- package/dist/src/render-drivers/threadx/ThreadXRenderDriver.js.map +0 -1
- package/dist/src/render-drivers/threadx/ThreadXRendererMessage.d.ts +0 -70
- package/dist/src/render-drivers/threadx/ThreadXRendererMessage.js +0 -32
- package/dist/src/render-drivers/threadx/ThreadXRendererMessage.js.map +0 -1
- package/dist/src/render-drivers/threadx/worker/ThreadXRendererNode.d.ts +0 -19
- package/dist/src/render-drivers/threadx/worker/ThreadXRendererNode.js +0 -177
- package/dist/src/render-drivers/threadx/worker/ThreadXRendererNode.js.map +0 -1
- package/dist/src/render-drivers/threadx/worker/ThreadXRendererTextNode.d.ts +0 -27
- package/dist/src/render-drivers/threadx/worker/ThreadXRendererTextNode.js +0 -108
- package/dist/src/render-drivers/threadx/worker/ThreadXRendererTextNode.js.map +0 -1
- package/dist/src/render-drivers/threadx/worker/renderer.d.ts +0 -1
- package/dist/src/render-drivers/threadx/worker/renderer.js +0 -145
- package/dist/src/render-drivers/threadx/worker/renderer.js.map +0 -1
- package/dist/src/render-drivers/utils.d.ts +0 -12
- package/dist/src/render-drivers/utils.js +0 -69
- package/dist/src/render-drivers/utils.js.map +0 -1
- /package/dist/src/core/{CoreStuff.d.ts → temp.d.ts} +0 -0
|
@@ -1,597 +1,601 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* If not stated otherwise in this file or this component's LICENSE file the
|
|
3
|
-
* following copyright and licenses apply:
|
|
4
|
-
*
|
|
5
|
-
* Copyright 2023 Comcast Cable Communications Management, LLC.
|
|
6
|
-
*
|
|
7
|
-
* Licensed under the Apache License, Version 2.0 (the License);
|
|
8
|
-
* you may not use this file except in compliance with the License.
|
|
9
|
-
* You may obtain a copy of the License at
|
|
10
|
-
*
|
|
11
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
-
*
|
|
13
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
14
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
-
* See the License for the specific language governing permissions and
|
|
17
|
-
* limitations under the License.
|
|
18
|
-
*/
|
|
19
|
-
|
|
20
|
-
import { ImageWorkerManager } from './lib/ImageWorker.js';
|
|
21
|
-
import type { CoreRenderer } from './renderers/CoreRenderer.js';
|
|
22
|
-
import { ColorTexture } from './textures/ColorTexture.js';
|
|
23
|
-
import { ImageTexture } from './textures/ImageTexture.js';
|
|
24
|
-
import { NoiseTexture } from './textures/NoiseTexture.js';
|
|
25
|
-
import { SubTexture } from './textures/SubTexture.js';
|
|
26
|
-
import { RenderTexture } from './textures/RenderTexture.js';
|
|
27
|
-
import { TextureType, type Texture } from './textures/Texture.js';
|
|
28
|
-
import { EventEmitter } from '../common/EventEmitter.js';
|
|
29
|
-
import { getTimeStamp } from './platform.js';
|
|
30
|
-
import type { Stage } from './Stage.js';
|
|
31
|
-
import {
|
|
32
|
-
validateCreateImageBitmap,
|
|
33
|
-
type CreateImageBitmapSupport,
|
|
34
|
-
} from './lib/validateImageBitmap.js';
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
* included
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
*
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
*
|
|
78
|
-
* clipX 0.
|
|
79
|
-
*
|
|
80
|
-
*
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
*
|
|
86
|
-
* clipY 0.
|
|
87
|
-
*
|
|
88
|
-
*
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
*
|
|
102
|
-
*
|
|
103
|
-
*
|
|
104
|
-
*
|
|
105
|
-
* texture
|
|
106
|
-
*
|
|
107
|
-
*
|
|
108
|
-
*
|
|
109
|
-
*
|
|
110
|
-
* the texture instance
|
|
111
|
-
*
|
|
112
|
-
*
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
*
|
|
118
|
-
*
|
|
119
|
-
*
|
|
120
|
-
*
|
|
121
|
-
*
|
|
122
|
-
*
|
|
123
|
-
*
|
|
124
|
-
*
|
|
125
|
-
*
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
*
|
|
132
|
-
*
|
|
133
|
-
*
|
|
134
|
-
*
|
|
135
|
-
*
|
|
136
|
-
*
|
|
137
|
-
*
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
*
|
|
144
|
-
*
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
*
|
|
151
|
-
*
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
*
|
|
158
|
-
* the
|
|
159
|
-
*
|
|
160
|
-
*
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
private
|
|
183
|
-
private
|
|
184
|
-
private
|
|
185
|
-
private
|
|
186
|
-
private
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
*
|
|
202
|
-
*
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
*
|
|
211
|
-
*
|
|
212
|
-
*
|
|
213
|
-
*
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
this.registerTextureType('
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
this.
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
this.
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
);
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
texture.
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
.
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
this.
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
this.
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
*
|
|
553
|
-
*
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
}
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
1
|
+
/*
|
|
2
|
+
* If not stated otherwise in this file or this component's LICENSE file the
|
|
3
|
+
* following copyright and licenses apply:
|
|
4
|
+
*
|
|
5
|
+
* Copyright 2023 Comcast Cable Communications Management, LLC.
|
|
6
|
+
*
|
|
7
|
+
* Licensed under the Apache License, Version 2.0 (the License);
|
|
8
|
+
* you may not use this file except in compliance with the License.
|
|
9
|
+
* You may obtain a copy of the License at
|
|
10
|
+
*
|
|
11
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
*
|
|
13
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
* See the License for the specific language governing permissions and
|
|
17
|
+
* limitations under the License.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
import { ImageWorkerManager } from './lib/ImageWorker.js';
|
|
21
|
+
import type { CoreRenderer } from './renderers/CoreRenderer.js';
|
|
22
|
+
import { ColorTexture } from './textures/ColorTexture.js';
|
|
23
|
+
import { ImageTexture } from './textures/ImageTexture.js';
|
|
24
|
+
import { NoiseTexture } from './textures/NoiseTexture.js';
|
|
25
|
+
import { SubTexture } from './textures/SubTexture.js';
|
|
26
|
+
import { RenderTexture } from './textures/RenderTexture.js';
|
|
27
|
+
import { TextureType, type Texture } from './textures/Texture.js';
|
|
28
|
+
import { EventEmitter } from '../common/EventEmitter.js';
|
|
29
|
+
import { getTimeStamp } from './platform.js';
|
|
30
|
+
import type { Stage } from './Stage.js';
|
|
31
|
+
import {
|
|
32
|
+
validateCreateImageBitmap,
|
|
33
|
+
type CreateImageBitmapSupport,
|
|
34
|
+
} from './lib/validateImageBitmap.js';
|
|
35
|
+
import type { Platform } from './platforms/Platform.js';
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Augmentable map of texture class types
|
|
39
|
+
*
|
|
40
|
+
* @remarks
|
|
41
|
+
* This interface can be augmented by other modules/apps to add additional
|
|
42
|
+
* texture types. The ones included directly here are the ones that are
|
|
43
|
+
* included in the core library.
|
|
44
|
+
*/
|
|
45
|
+
export interface TextureMap {
|
|
46
|
+
ColorTexture: typeof ColorTexture;
|
|
47
|
+
ImageTexture: typeof ImageTexture;
|
|
48
|
+
NoiseTexture: typeof NoiseTexture;
|
|
49
|
+
SubTexture: typeof SubTexture;
|
|
50
|
+
RenderTexture: typeof RenderTexture;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export type ExtractProps<Type> = Type extends { z$__type__Props: infer Props }
|
|
54
|
+
? Props
|
|
55
|
+
: never;
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Contains information about the texture manager's internal state
|
|
59
|
+
* for debugging purposes.
|
|
60
|
+
*/
|
|
61
|
+
export interface TextureManagerDebugInfo {
|
|
62
|
+
keyCacheSize: number;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export interface TextureManagerSettings {
|
|
66
|
+
numImageWorkers: number;
|
|
67
|
+
createImageBitmapSupport: 'auto' | 'basic' | 'options' | 'full';
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export type ResizeModeOptions =
|
|
71
|
+
| {
|
|
72
|
+
/**
|
|
73
|
+
* Specifies that the image should be resized to cover the specified dimensions.
|
|
74
|
+
*/
|
|
75
|
+
type: 'cover';
|
|
76
|
+
/**
|
|
77
|
+
* The horizontal clipping position
|
|
78
|
+
* To clip the left, set clipX to 0. To clip the right, set clipX to 1.
|
|
79
|
+
* clipX 0.5 will clip a equal amount from left and right
|
|
80
|
+
*
|
|
81
|
+
* @defaultValue 0.5
|
|
82
|
+
*/
|
|
83
|
+
clipX?: number;
|
|
84
|
+
/**
|
|
85
|
+
* The vertical clipping position
|
|
86
|
+
* To clip the top, set clipY to 0. To clip the bottom, set clipY to 1.
|
|
87
|
+
* clipY 0.5 will clip a equal amount from top and bottom
|
|
88
|
+
*
|
|
89
|
+
* @defaultValue 0.5
|
|
90
|
+
*/
|
|
91
|
+
clipY?: number;
|
|
92
|
+
}
|
|
93
|
+
| {
|
|
94
|
+
/**
|
|
95
|
+
* Specifies that the image should be resized to fit within the specified dimensions.
|
|
96
|
+
*/
|
|
97
|
+
type: 'contain';
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Universal options for all texture types
|
|
102
|
+
*
|
|
103
|
+
* @remarks
|
|
104
|
+
* Texture Options provide a way to specify options that are relevant to the
|
|
105
|
+
* texture loading process (including caching) and specifically for how a
|
|
106
|
+
* texture is rendered within a specific Node (or set of Nodes).
|
|
107
|
+
*
|
|
108
|
+
* They are not used in determining the cache key for a texture (except if
|
|
109
|
+
* the `cacheKey` option is provided explicitly to oveerride the default
|
|
110
|
+
* cache key for the texture instance) nor are they stored/referenced within
|
|
111
|
+
* the texture instance itself. Instead, the options are stored/referenced
|
|
112
|
+
* within individual Nodes. So a single texture instance can be used in
|
|
113
|
+
* multiple Nodes each using a different set of options.
|
|
114
|
+
*/
|
|
115
|
+
export interface TextureOptions {
|
|
116
|
+
/**
|
|
117
|
+
* Preload the texture immediately even if it's not being rendered to the
|
|
118
|
+
* screen.
|
|
119
|
+
*
|
|
120
|
+
* @remarks
|
|
121
|
+
* This allows the texture to be used immediately without any delay when it
|
|
122
|
+
* is first needed for rendering. Otherwise the loading process will start
|
|
123
|
+
* when the texture is first rendered, which may cause a delay in that texture
|
|
124
|
+
* being shown properly.
|
|
125
|
+
*
|
|
126
|
+
* @defaultValue `false`
|
|
127
|
+
*/
|
|
128
|
+
preload?: boolean;
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Prevent clean up of the texture when it is no longer being used.
|
|
132
|
+
*
|
|
133
|
+
* @remarks
|
|
134
|
+
* This is useful when you want to keep the texture in memory for later use.
|
|
135
|
+
* Regardless of whether the texture is being used or not, it will not be
|
|
136
|
+
* cleaned up.
|
|
137
|
+
*
|
|
138
|
+
* @defaultValue `false`
|
|
139
|
+
*/
|
|
140
|
+
preventCleanup?: boolean;
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* Flip the texture horizontally when rendering
|
|
144
|
+
*
|
|
145
|
+
* @defaultValue `false`
|
|
146
|
+
*/
|
|
147
|
+
flipX?: boolean;
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* Flip the texture vertically when rendering
|
|
151
|
+
*
|
|
152
|
+
* @defaultValue `false`
|
|
153
|
+
*/
|
|
154
|
+
flipY?: boolean;
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* You can use resizeMode to determine the clipping automatically from the width
|
|
158
|
+
* and height of the source texture. This can be convenient if you are unsure about
|
|
159
|
+
* the exact image sizes but want the image to cover a specific area.
|
|
160
|
+
*
|
|
161
|
+
* The resize modes cover and contain are supported
|
|
162
|
+
*/
|
|
163
|
+
resizeMode?: ResizeModeOptions;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
export class CoreTextureManager extends EventEmitter {
|
|
167
|
+
/**
|
|
168
|
+
* Map of textures by cache key
|
|
169
|
+
*/
|
|
170
|
+
keyCache: Map<string, Texture> = new Map();
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* Map of cache keys by texture
|
|
174
|
+
*/
|
|
175
|
+
inverseKeyCache: WeakMap<Texture, string> = new WeakMap();
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* Map of texture constructors by their type name
|
|
179
|
+
*/
|
|
180
|
+
txConstructors: Partial<TextureMap> = {};
|
|
181
|
+
|
|
182
|
+
private downloadTextureSourceQueue: Array<Texture> = [];
|
|
183
|
+
private priorityQueue: Array<Texture> = [];
|
|
184
|
+
private uploadTextureQueue: Array<Texture> = [];
|
|
185
|
+
private initialized = false;
|
|
186
|
+
private stage: Stage;
|
|
187
|
+
private numImageWorkers: number;
|
|
188
|
+
|
|
189
|
+
public platform: Platform;
|
|
190
|
+
|
|
191
|
+
imageWorkerManager: ImageWorkerManager | null = null;
|
|
192
|
+
hasCreateImageBitmap = false;
|
|
193
|
+
imageBitmapSupported = {
|
|
194
|
+
basic: false,
|
|
195
|
+
options: false,
|
|
196
|
+
full: false,
|
|
197
|
+
};
|
|
198
|
+
|
|
199
|
+
hasWorker = !!self.Worker;
|
|
200
|
+
/**
|
|
201
|
+
* Renderer that this texture manager is associated with
|
|
202
|
+
*
|
|
203
|
+
* @remarks
|
|
204
|
+
* This MUST be set before the texture manager is used. Otherwise errors
|
|
205
|
+
* will occur when using the texture manager.
|
|
206
|
+
*/
|
|
207
|
+
renderer!: CoreRenderer;
|
|
208
|
+
|
|
209
|
+
/**
|
|
210
|
+
* The current frame time in milliseconds
|
|
211
|
+
*
|
|
212
|
+
* @remarks
|
|
213
|
+
* This is used to populate the `lastRenderableChangeTime` property of
|
|
214
|
+
* {@link Texture} instances when their renderable state changes.
|
|
215
|
+
*
|
|
216
|
+
* Set by stage via `updateFrameTime` method.
|
|
217
|
+
*/
|
|
218
|
+
frameTime = 0;
|
|
219
|
+
|
|
220
|
+
constructor(stage: Stage, settings: TextureManagerSettings) {
|
|
221
|
+
super();
|
|
222
|
+
|
|
223
|
+
const { numImageWorkers, createImageBitmapSupport } = settings;
|
|
224
|
+
this.stage = stage;
|
|
225
|
+
this.platform = stage.platform;
|
|
226
|
+
this.numImageWorkers = numImageWorkers;
|
|
227
|
+
|
|
228
|
+
if (createImageBitmapSupport === 'auto') {
|
|
229
|
+
validateCreateImageBitmap(this.platform)
|
|
230
|
+
.then((result) => {
|
|
231
|
+
this.initialize(result);
|
|
232
|
+
})
|
|
233
|
+
.catch((e) => {
|
|
234
|
+
console.warn(
|
|
235
|
+
'[Lightning] createImageBitmap is not supported on this browser. ImageTexture will be slower.',
|
|
236
|
+
);
|
|
237
|
+
|
|
238
|
+
// initialized without image worker manager and createImageBitmap
|
|
239
|
+
this.initialized = true;
|
|
240
|
+
this.emit('initialized');
|
|
241
|
+
});
|
|
242
|
+
} else {
|
|
243
|
+
this.initialize({
|
|
244
|
+
basic: createImageBitmapSupport === 'basic',
|
|
245
|
+
options: createImageBitmapSupport === 'options',
|
|
246
|
+
full: createImageBitmapSupport === 'full',
|
|
247
|
+
});
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
this.registerTextureType('ImageTexture', ImageTexture);
|
|
251
|
+
this.registerTextureType('ColorTexture', ColorTexture);
|
|
252
|
+
this.registerTextureType('NoiseTexture', NoiseTexture);
|
|
253
|
+
this.registerTextureType('SubTexture', SubTexture);
|
|
254
|
+
this.registerTextureType('RenderTexture', RenderTexture);
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
registerTextureType<Type extends keyof TextureMap>(
|
|
258
|
+
textureType: Type,
|
|
259
|
+
textureClass: TextureMap[Type],
|
|
260
|
+
): void {
|
|
261
|
+
this.txConstructors[textureType] = textureClass;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
private initialize(support: CreateImageBitmapSupport) {
|
|
265
|
+
this.hasCreateImageBitmap =
|
|
266
|
+
support.basic || support.options || support.full;
|
|
267
|
+
this.imageBitmapSupported = support;
|
|
268
|
+
|
|
269
|
+
if (this.hasCreateImageBitmap === false) {
|
|
270
|
+
console.warn(
|
|
271
|
+
'[Lightning] createImageBitmap is not supported on this browser. ImageTexture will be slower.',
|
|
272
|
+
);
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
if (
|
|
276
|
+
this.hasCreateImageBitmap === true &&
|
|
277
|
+
this.hasWorker === true &&
|
|
278
|
+
this.numImageWorkers > 0
|
|
279
|
+
) {
|
|
280
|
+
this.imageWorkerManager = new ImageWorkerManager(
|
|
281
|
+
this.numImageWorkers,
|
|
282
|
+
support,
|
|
283
|
+
);
|
|
284
|
+
} else {
|
|
285
|
+
console.warn(
|
|
286
|
+
'[Lightning] Imageworker is 0 or not supported on this browser. Image loading will be slower.',
|
|
287
|
+
);
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
this.initialized = true;
|
|
291
|
+
this.emit('initialized');
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
/**
|
|
295
|
+
* Enqueue a texture for downloading its source image.
|
|
296
|
+
*/
|
|
297
|
+
enqueueDownloadTextureSource(texture: Texture): void {
|
|
298
|
+
if (!this.downloadTextureSourceQueue.includes(texture)) {
|
|
299
|
+
this.downloadTextureSourceQueue.push(texture);
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
/**
|
|
304
|
+
* Enqueue a texture for uploading to the GPU.
|
|
305
|
+
*
|
|
306
|
+
* @param texture - The texture to upload
|
|
307
|
+
*/
|
|
308
|
+
enqueueUploadTexture(texture: Texture): void {
|
|
309
|
+
if (this.uploadTextureQueue.includes(texture) === false) {
|
|
310
|
+
this.uploadTextureQueue.push(texture);
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
/**
|
|
315
|
+
* Create a texture
|
|
316
|
+
*
|
|
317
|
+
* @param textureType - The type of texture to create
|
|
318
|
+
* @param props - The properties to use for the texture
|
|
319
|
+
*/
|
|
320
|
+
createTexture<Type extends keyof TextureMap>(
|
|
321
|
+
textureType: Type,
|
|
322
|
+
props: ExtractProps<TextureMap[Type]>,
|
|
323
|
+
): InstanceType<TextureMap[Type]> {
|
|
324
|
+
let texture: Texture | undefined;
|
|
325
|
+
const TextureClass = this.txConstructors[textureType];
|
|
326
|
+
if (!TextureClass) {
|
|
327
|
+
throw new Error(`Texture type "${textureType}" is not registered`);
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
const cacheKey = TextureClass.makeCacheKey(props as any);
|
|
331
|
+
if (cacheKey && this.keyCache.has(cacheKey)) {
|
|
332
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
333
|
+
texture = this.keyCache.get(cacheKey)!;
|
|
334
|
+
} else {
|
|
335
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-explicit-any
|
|
336
|
+
texture = new TextureClass(this, props as any);
|
|
337
|
+
|
|
338
|
+
if (cacheKey) {
|
|
339
|
+
this.initTextureToCache(texture, cacheKey);
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
return texture as InstanceType<TextureMap[Type]>;
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
orphanTexture(texture: Texture): void {
|
|
347
|
+
// if it is part of the download or upload queue, remove it
|
|
348
|
+
this.removeTextureFromQueue(texture);
|
|
349
|
+
|
|
350
|
+
if (texture.type === TextureType.subTexture) {
|
|
351
|
+
// ignore subtextures
|
|
352
|
+
return;
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
this.stage.txMemManager.addToOrphanedTextures(texture);
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
/**
|
|
359
|
+
* Override loadTexture to use the batched approach.
|
|
360
|
+
*
|
|
361
|
+
* @param texture - The texture to load
|
|
362
|
+
* @param immediate - Whether to prioritize the texture for immediate loading
|
|
363
|
+
*/
|
|
364
|
+
loadTexture(texture: Texture, priority?: boolean): void {
|
|
365
|
+
this.stage.txMemManager.removeFromOrphanedTextures(texture);
|
|
366
|
+
|
|
367
|
+
if (texture.type === TextureType.subTexture) {
|
|
368
|
+
// ignore subtextures - they get loaded through their parent
|
|
369
|
+
return;
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
// if the texture is already loaded, don't load it again
|
|
373
|
+
if (
|
|
374
|
+
texture.ctxTexture !== undefined &&
|
|
375
|
+
texture.ctxTexture.state === 'loaded'
|
|
376
|
+
) {
|
|
377
|
+
texture.setState('loaded');
|
|
378
|
+
return;
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
// if the texture is already being processed, don't load it again
|
|
382
|
+
if (
|
|
383
|
+
this.downloadTextureSourceQueue.includes(texture) === true ||
|
|
384
|
+
this.uploadTextureQueue.includes(texture) === true
|
|
385
|
+
) {
|
|
386
|
+
return;
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
// if the texture is already loading, free it, this can happen if the texture is
|
|
390
|
+
// orphaned and then reloaded
|
|
391
|
+
if (
|
|
392
|
+
texture.ctxTexture !== undefined &&
|
|
393
|
+
texture.ctxTexture.state === 'loading'
|
|
394
|
+
) {
|
|
395
|
+
// if the texture has texture data, queue it for upload
|
|
396
|
+
if (texture.textureData !== null) {
|
|
397
|
+
this.enqueueUploadTexture(texture);
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
// else we will have to re-download the texture
|
|
401
|
+
texture.free();
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
// if we're not initialized, just queue the texture into the priority queue
|
|
405
|
+
if (this.initialized === false) {
|
|
406
|
+
this.priorityQueue.push(texture);
|
|
407
|
+
return;
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
// these types of textures don't need to be downloaded
|
|
411
|
+
// Technically the noise texture shouldn't either, but it's a special case
|
|
412
|
+
// and not really used in production so who cares ¯\_(ツ)_/¯
|
|
413
|
+
if (
|
|
414
|
+
(texture.type === TextureType.color ||
|
|
415
|
+
texture.type === TextureType.renderToTexture) &&
|
|
416
|
+
texture.state !== 'initial'
|
|
417
|
+
) {
|
|
418
|
+
texture.setState('fetched');
|
|
419
|
+
this.enqueueUploadTexture(texture);
|
|
420
|
+
return;
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
texture.setState('loading');
|
|
424
|
+
|
|
425
|
+
// prioritize the texture for immediate loading
|
|
426
|
+
if (priority === true) {
|
|
427
|
+
texture
|
|
428
|
+
.getTextureData()
|
|
429
|
+
.then(() => {
|
|
430
|
+
this.uploadTexture(texture);
|
|
431
|
+
})
|
|
432
|
+
.catch((err) => {
|
|
433
|
+
console.error(err);
|
|
434
|
+
});
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
// enqueue the texture for download and upload
|
|
438
|
+
this.enqueueDownloadTextureSource(texture);
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
/**
|
|
442
|
+
* Upload a texture to the GPU
|
|
443
|
+
*
|
|
444
|
+
* @param texture Texture to upload
|
|
445
|
+
*/
|
|
446
|
+
uploadTexture(texture: Texture): void {
|
|
447
|
+
if (
|
|
448
|
+
this.stage.txMemManager.doNotExceedCriticalThreshold === true &&
|
|
449
|
+
this.stage.txMemManager.criticalCleanupRequested === true
|
|
450
|
+
) {
|
|
451
|
+
// we're at a critical memory threshold, don't upload textures
|
|
452
|
+
this.enqueueUploadTexture(texture);
|
|
453
|
+
return;
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
const coreContext = texture.loadCtxTexture();
|
|
457
|
+
if (coreContext !== null && coreContext.state === 'loaded') {
|
|
458
|
+
texture.setState('loaded');
|
|
459
|
+
return;
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
coreContext.load();
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
/**
|
|
466
|
+
* Check if a texture is being processed
|
|
467
|
+
*/
|
|
468
|
+
isProcessingTexture(texture: Texture): boolean {
|
|
469
|
+
return (
|
|
470
|
+
this.downloadTextureSourceQueue.includes(texture) === true ||
|
|
471
|
+
this.uploadTextureQueue.includes(texture) === true
|
|
472
|
+
);
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
/**
|
|
476
|
+
* Process a limited number of downloads and uploads.
|
|
477
|
+
*
|
|
478
|
+
* @param maxItems - The maximum number of items to process
|
|
479
|
+
*/
|
|
480
|
+
processSome(maxProcessingTime: number): void {
|
|
481
|
+
if (this.initialized === false) {
|
|
482
|
+
return;
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
const startTime = getTimeStamp();
|
|
486
|
+
|
|
487
|
+
// Process priority queue
|
|
488
|
+
while (
|
|
489
|
+
this.priorityQueue.length > 0 &&
|
|
490
|
+
getTimeStamp() - startTime < maxProcessingTime
|
|
491
|
+
) {
|
|
492
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
493
|
+
const texture = this.priorityQueue.pop()!;
|
|
494
|
+
texture.getTextureData().then(() => {
|
|
495
|
+
this.uploadTexture(texture);
|
|
496
|
+
});
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
// Process uploads
|
|
500
|
+
while (
|
|
501
|
+
this.uploadTextureQueue.length > 0 &&
|
|
502
|
+
getTimeStamp() - startTime < maxProcessingTime
|
|
503
|
+
) {
|
|
504
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
505
|
+
this.uploadTexture(this.uploadTextureQueue.pop()!);
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
// Process downloads
|
|
509
|
+
while (
|
|
510
|
+
this.downloadTextureSourceQueue.length > 0 &&
|
|
511
|
+
getTimeStamp() - startTime < maxProcessingTime
|
|
512
|
+
) {
|
|
513
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
514
|
+
const texture = this.downloadTextureSourceQueue.shift()!;
|
|
515
|
+
texture.getTextureData().then(() => {
|
|
516
|
+
if (texture.state === 'fetched') {
|
|
517
|
+
this.enqueueUploadTexture(texture);
|
|
518
|
+
}
|
|
519
|
+
});
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
public hasUpdates(): boolean {
|
|
524
|
+
return (
|
|
525
|
+
this.downloadTextureSourceQueue.length > 0 ||
|
|
526
|
+
this.uploadTextureQueue.length > 0
|
|
527
|
+
);
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
/**
|
|
531
|
+
* Initialize a texture to the cache
|
|
532
|
+
*
|
|
533
|
+
* @param texture Texture to cache
|
|
534
|
+
* @param cacheKey Cache key for the texture
|
|
535
|
+
*/
|
|
536
|
+
initTextureToCache(texture: Texture, cacheKey: string) {
|
|
537
|
+
const { keyCache, inverseKeyCache } = this;
|
|
538
|
+
keyCache.set(cacheKey, texture);
|
|
539
|
+
inverseKeyCache.set(texture, cacheKey);
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
/**
|
|
543
|
+
* Get a texture from the cache
|
|
544
|
+
*
|
|
545
|
+
* @param cacheKey
|
|
546
|
+
*/
|
|
547
|
+
getTextureFromCache(cacheKey: string): Texture | undefined {
|
|
548
|
+
return this.keyCache.get(cacheKey);
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
/**
|
|
552
|
+
* Remove a texture from the cache
|
|
553
|
+
*
|
|
554
|
+
* @remarks
|
|
555
|
+
* Called by Texture Cleanup when a texture is freed.
|
|
556
|
+
*
|
|
557
|
+
* @param texture
|
|
558
|
+
*/
|
|
559
|
+
removeTextureFromCache(texture: Texture) {
|
|
560
|
+
const { inverseKeyCache, keyCache } = this;
|
|
561
|
+
const cacheKey = inverseKeyCache.get(texture);
|
|
562
|
+
if (cacheKey) {
|
|
563
|
+
keyCache.delete(cacheKey);
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
/**
|
|
568
|
+
* Remove texture from the queue's
|
|
569
|
+
*
|
|
570
|
+
* @param texture - The texture to remove
|
|
571
|
+
*/
|
|
572
|
+
removeTextureFromQueue(texture: Texture): void {
|
|
573
|
+
const downloadIndex = this.downloadTextureSourceQueue.indexOf(texture);
|
|
574
|
+
if (downloadIndex !== -1) {
|
|
575
|
+
this.downloadTextureSourceQueue.splice(downloadIndex, 1);
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
const uploadIndex = this.uploadTextureQueue.indexOf(texture);
|
|
579
|
+
if (uploadIndex !== -1) {
|
|
580
|
+
this.uploadTextureQueue.splice(uploadIndex, 1);
|
|
581
|
+
}
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
/**
|
|
585
|
+
* Resolve a parent texture from the cache or fallback to the provided texture.
|
|
586
|
+
*
|
|
587
|
+
* @param texture - The provided texture to resolve.
|
|
588
|
+
* @returns The cached or provided texture.
|
|
589
|
+
*/
|
|
590
|
+
resolveParentTexture(texture: ImageTexture): Texture {
|
|
591
|
+
if (!texture?.props) {
|
|
592
|
+
return texture;
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
const cacheKey = ImageTexture.makeCacheKey(texture.props);
|
|
596
|
+
const cachedTexture = cacheKey
|
|
597
|
+
? this.getTextureFromCache(cacheKey)
|
|
598
|
+
: undefined;
|
|
599
|
+
return cachedTexture ?? texture;
|
|
600
|
+
}
|
|
601
|
+
}
|