@kurot/core 1.0.12
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/LICENSE +21 -0
- package/README.md +154 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +14 -0
- package/dist/index.js.map +1 -0
- package/dist/kurot/benchmark/BenchmarkRunner.d.ts +60 -0
- package/dist/kurot/benchmark/BenchmarkRunner.d.ts.map +1 -0
- package/dist/kurot/benchmark/BenchmarkRunner.js +112 -0
- package/dist/kurot/benchmark/BenchmarkRunner.js.map +1 -0
- package/dist/kurot/benchmark/MetricsCollector.d.ts +34 -0
- package/dist/kurot/benchmark/MetricsCollector.d.ts.map +1 -0
- package/dist/kurot/benchmark/MetricsCollector.js +123 -0
- package/dist/kurot/benchmark/MetricsCollector.js.map +1 -0
- package/dist/kurot/benchmark/PerfPanel.d.ts +24 -0
- package/dist/kurot/benchmark/PerfPanel.d.ts.map +1 -0
- package/dist/kurot/benchmark/PerfPanel.js +131 -0
- package/dist/kurot/benchmark/PerfPanel.js.map +1 -0
- package/dist/kurot/benchmark/ReportExporter.d.ts +8 -0
- package/dist/kurot/benchmark/ReportExporter.d.ts.map +1 -0
- package/dist/kurot/benchmark/ReportExporter.js +54 -0
- package/dist/kurot/benchmark/ReportExporter.js.map +1 -0
- package/dist/kurot/benchmark/SceneRegistry.d.ts +16 -0
- package/dist/kurot/benchmark/SceneRegistry.d.ts.map +1 -0
- package/dist/kurot/benchmark/SceneRegistry.js +233 -0
- package/dist/kurot/benchmark/SceneRegistry.js.map +1 -0
- package/dist/kurot/benchmark/types.d.ts +47 -0
- package/dist/kurot/benchmark/types.d.ts.map +1 -0
- package/dist/kurot/benchmark/types.js +2 -0
- package/dist/kurot/benchmark/types.js.map +1 -0
- package/dist/kurot/display/Bitmap.d.ts +53 -0
- package/dist/kurot/display/Bitmap.d.ts.map +1 -0
- package/dist/kurot/display/Bitmap.js +185 -0
- package/dist/kurot/display/Bitmap.js.map +1 -0
- package/dist/kurot/display/DisplayObject.d.ts +253 -0
- package/dist/kurot/display/DisplayObject.d.ts.map +1 -0
- package/dist/kurot/display/DisplayObject.js +833 -0
- package/dist/kurot/display/DisplayObject.js.map +1 -0
- package/dist/kurot/display/DisplayObjectContainer.d.ts +57 -0
- package/dist/kurot/display/DisplayObjectContainer.d.ts.map +1 -0
- package/dist/kurot/display/DisplayObjectContainer.js +330 -0
- package/dist/kurot/display/DisplayObjectContainer.js.map +1 -0
- package/dist/kurot/display/Graphics.d.ts +48 -0
- package/dist/kurot/display/Graphics.d.ts.map +1 -0
- package/dist/kurot/display/Graphics.js +315 -0
- package/dist/kurot/display/Graphics.js.map +1 -0
- package/dist/kurot/display/GraphicsPath.d.ts +112 -0
- package/dist/kurot/display/GraphicsPath.d.ts.map +1 -0
- package/dist/kurot/display/GraphicsPath.js +2 -0
- package/dist/kurot/display/GraphicsPath.js.map +1 -0
- package/dist/kurot/display/Mesh.d.ts +21 -0
- package/dist/kurot/display/Mesh.d.ts.map +1 -0
- package/dist/kurot/display/Mesh.js +56 -0
- package/dist/kurot/display/Mesh.js.map +1 -0
- package/dist/kurot/display/Shape.d.ts +12 -0
- package/dist/kurot/display/Shape.d.ts.map +1 -0
- package/dist/kurot/display/Shape.js +35 -0
- package/dist/kurot/display/Shape.js.map +1 -0
- package/dist/kurot/display/Sprite.d.ts +13 -0
- package/dist/kurot/display/Sprite.d.ts.map +1 -0
- package/dist/kurot/display/Sprite.js +38 -0
- package/dist/kurot/display/Sprite.js.map +1 -0
- package/dist/kurot/display/Stage.d.ts +45 -0
- package/dist/kurot/display/Stage.d.ts.map +1 -0
- package/dist/kurot/display/Stage.js +107 -0
- package/dist/kurot/display/Stage.js.map +1 -0
- package/dist/kurot/display/enums/BitmapFillMode.d.ts +7 -0
- package/dist/kurot/display/enums/BitmapFillMode.d.ts.map +1 -0
- package/dist/kurot/display/enums/BitmapFillMode.js +6 -0
- package/dist/kurot/display/enums/BitmapFillMode.js.map +1 -0
- package/dist/kurot/display/enums/BlendMode.d.ts +24 -0
- package/dist/kurot/display/enums/BlendMode.d.ts.map +1 -0
- package/dist/kurot/display/enums/BlendMode.js +31 -0
- package/dist/kurot/display/enums/BlendMode.js.map +1 -0
- package/dist/kurot/display/enums/CapsStyle.d.ts +7 -0
- package/dist/kurot/display/enums/CapsStyle.d.ts.map +1 -0
- package/dist/kurot/display/enums/CapsStyle.js +6 -0
- package/dist/kurot/display/enums/CapsStyle.js.map +1 -0
- package/dist/kurot/display/enums/GradientType.d.ts +6 -0
- package/dist/kurot/display/enums/GradientType.d.ts.map +1 -0
- package/dist/kurot/display/enums/GradientType.js +5 -0
- package/dist/kurot/display/enums/GradientType.js.map +1 -0
- package/dist/kurot/display/enums/JointStyle.d.ts +7 -0
- package/dist/kurot/display/enums/JointStyle.d.ts.map +1 -0
- package/dist/kurot/display/enums/JointStyle.js +6 -0
- package/dist/kurot/display/enums/JointStyle.js.map +1 -0
- package/dist/kurot/display/enums/OrientationMode.d.ts +8 -0
- package/dist/kurot/display/enums/OrientationMode.d.ts.map +1 -0
- package/dist/kurot/display/enums/OrientationMode.js +7 -0
- package/dist/kurot/display/enums/OrientationMode.js.map +1 -0
- package/dist/kurot/display/enums/StageScaleMode.d.ts +12 -0
- package/dist/kurot/display/enums/StageScaleMode.d.ts.map +1 -0
- package/dist/kurot/display/enums/StageScaleMode.js +11 -0
- package/dist/kurot/display/enums/StageScaleMode.js.map +1 -0
- package/dist/kurot/display/enums/index.d.ts +8 -0
- package/dist/kurot/display/enums/index.d.ts.map +1 -0
- package/dist/kurot/display/enums/index.js +8 -0
- package/dist/kurot/display/enums/index.js.map +1 -0
- package/dist/kurot/display/index.d.ts +21 -0
- package/dist/kurot/display/index.d.ts.map +1 -0
- package/dist/kurot/display/index.js +20 -0
- package/dist/kurot/display/index.js.map +1 -0
- package/dist/kurot/display/texture/BitmapData.d.ts +36 -0
- package/dist/kurot/display/texture/BitmapData.d.ts.map +1 -0
- package/dist/kurot/display/texture/BitmapData.js +129 -0
- package/dist/kurot/display/texture/BitmapData.js.map +1 -0
- package/dist/kurot/display/texture/RenderTexture.d.ts +15 -0
- package/dist/kurot/display/texture/RenderTexture.d.ts.map +1 -0
- package/dist/kurot/display/texture/RenderTexture.js +58 -0
- package/dist/kurot/display/texture/RenderTexture.js.map +1 -0
- package/dist/kurot/display/texture/SpriteSheet.d.ts +12 -0
- package/dist/kurot/display/texture/SpriteSheet.d.ts.map +1 -0
- package/dist/kurot/display/texture/SpriteSheet.js +32 -0
- package/dist/kurot/display/texture/SpriteSheet.js.map +1 -0
- package/dist/kurot/display/texture/Texture.d.ts +32 -0
- package/dist/kurot/display/texture/Texture.d.ts.map +1 -0
- package/dist/kurot/display/texture/Texture.js +76 -0
- package/dist/kurot/display/texture/Texture.js.map +1 -0
- package/dist/kurot/display/texture/index.d.ts +5 -0
- package/dist/kurot/display/texture/index.d.ts.map +1 -0
- package/dist/kurot/display/texture/index.js +5 -0
- package/dist/kurot/display/texture/index.js.map +1 -0
- package/dist/kurot/events/Event.d.ts +58 -0
- package/dist/kurot/events/Event.d.ts.map +1 -0
- package/dist/kurot/events/Event.js +142 -0
- package/dist/kurot/events/Event.js.map +1 -0
- package/dist/kurot/events/EventDispatcher.d.ts +25 -0
- package/dist/kurot/events/EventDispatcher.d.ts.map +1 -0
- package/dist/kurot/events/EventDispatcher.js +121 -0
- package/dist/kurot/events/EventDispatcher.js.map +1 -0
- package/dist/kurot/events/EventPhase.d.ts +6 -0
- package/dist/kurot/events/EventPhase.d.ts.map +1 -0
- package/dist/kurot/events/EventPhase.js +2 -0
- package/dist/kurot/events/EventPhase.js.map +1 -0
- package/dist/kurot/events/FocusEvent.d.ts +7 -0
- package/dist/kurot/events/FocusEvent.d.ts.map +1 -0
- package/dist/kurot/events/FocusEvent.js +11 -0
- package/dist/kurot/events/FocusEvent.js.map +1 -0
- package/dist/kurot/events/HTTPStatusEvent.d.ts +10 -0
- package/dist/kurot/events/HTTPStatusEvent.d.ts.map +1 -0
- package/dist/kurot/events/HTTPStatusEvent.js +24 -0
- package/dist/kurot/events/HTTPStatusEvent.js.map +1 -0
- package/dist/kurot/events/IEventDispatcher.d.ts +10 -0
- package/dist/kurot/events/IEventDispatcher.d.ts.map +1 -0
- package/dist/kurot/events/IEventDispatcher.js +2 -0
- package/dist/kurot/events/IEventDispatcher.js.map +1 -0
- package/dist/kurot/events/IOErrorEvent.d.ts +8 -0
- package/dist/kurot/events/IOErrorEvent.d.ts.map +1 -0
- package/dist/kurot/events/IOErrorEvent.js +17 -0
- package/dist/kurot/events/IOErrorEvent.js.map +1 -0
- package/dist/kurot/events/ProgressEvent.d.ts +11 -0
- package/dist/kurot/events/ProgressEvent.d.ts.map +1 -0
- package/dist/kurot/events/ProgressEvent.js +25 -0
- package/dist/kurot/events/ProgressEvent.js.map +1 -0
- package/dist/kurot/events/StageOrientationEvent.d.ts +8 -0
- package/dist/kurot/events/StageOrientationEvent.d.ts.map +1 -0
- package/dist/kurot/events/StageOrientationEvent.js +17 -0
- package/dist/kurot/events/StageOrientationEvent.js.map +1 -0
- package/dist/kurot/events/TextEvent.d.ts +9 -0
- package/dist/kurot/events/TextEvent.d.ts.map +1 -0
- package/dist/kurot/events/TextEvent.js +21 -0
- package/dist/kurot/events/TextEvent.js.map +1 -0
- package/dist/kurot/events/TimerEvent.d.ts +14 -0
- package/dist/kurot/events/TimerEvent.d.ts.map +1 -0
- package/dist/kurot/events/TimerEvent.js +27 -0
- package/dist/kurot/events/TimerEvent.js.map +1 -0
- package/dist/kurot/events/TouchEvent.d.ts +32 -0
- package/dist/kurot/events/TouchEvent.d.ts.map +1 -0
- package/dist/kurot/events/TouchEvent.js +85 -0
- package/dist/kurot/events/TouchEvent.js.map +1 -0
- package/dist/kurot/events/index.d.ts +13 -0
- package/dist/kurot/events/index.d.ts.map +1 -0
- package/dist/kurot/events/index.js +11 -0
- package/dist/kurot/events/index.js.map +1 -0
- package/dist/kurot/external/ExternalInterface.d.ts +18 -0
- package/dist/kurot/external/ExternalInterface.d.ts.map +1 -0
- package/dist/kurot/external/ExternalInterface.js +23 -0
- package/dist/kurot/external/ExternalInterface.js.map +1 -0
- package/dist/kurot/external/index.d.ts +2 -0
- package/dist/kurot/external/index.d.ts.map +1 -0
- package/dist/kurot/external/index.js +2 -0
- package/dist/kurot/external/index.js.map +1 -0
- package/dist/kurot/filters/BlurFilter.d.ts +16 -0
- package/dist/kurot/filters/BlurFilter.d.ts.map +1 -0
- package/dist/kurot/filters/BlurFilter.js +56 -0
- package/dist/kurot/filters/BlurFilter.js.map +1 -0
- package/dist/kurot/filters/ColorMatrixFilter.d.ts +10 -0
- package/dist/kurot/filters/ColorMatrixFilter.d.ts.map +1 -0
- package/dist/kurot/filters/ColorMatrixFilter.js +51 -0
- package/dist/kurot/filters/ColorMatrixFilter.js.map +1 -0
- package/dist/kurot/filters/CustomFilter.d.ts +12 -0
- package/dist/kurot/filters/CustomFilter.d.ts.map +1 -0
- package/dist/kurot/filters/CustomFilter.js +43 -0
- package/dist/kurot/filters/CustomFilter.js.map +1 -0
- package/dist/kurot/filters/DropShadowFilter.d.ts +16 -0
- package/dist/kurot/filters/DropShadowFilter.d.ts.map +1 -0
- package/dist/kurot/filters/DropShadowFilter.js +76 -0
- package/dist/kurot/filters/DropShadowFilter.js.map +1 -0
- package/dist/kurot/filters/Filter.d.ts +18 -0
- package/dist/kurot/filters/Filter.d.ts.map +1 -0
- package/dist/kurot/filters/Filter.js +22 -0
- package/dist/kurot/filters/Filter.js.map +1 -0
- package/dist/kurot/filters/GlowFilter.d.ts +34 -0
- package/dist/kurot/filters/GlowFilter.d.ts.map +1 -0
- package/dist/kurot/filters/GlowFilter.js +131 -0
- package/dist/kurot/filters/GlowFilter.js.map +1 -0
- package/dist/kurot/filters/index.d.ts +7 -0
- package/dist/kurot/filters/index.d.ts.map +1 -0
- package/dist/kurot/filters/index.js +7 -0
- package/dist/kurot/filters/index.js.map +1 -0
- package/dist/kurot/geom/Matrix.d.ts +50 -0
- package/dist/kurot/geom/Matrix.d.ts.map +1 -0
- package/dist/kurot/geom/Matrix.js +310 -0
- package/dist/kurot/geom/Matrix.js.map +1 -0
- package/dist/kurot/geom/Point.d.ts +23 -0
- package/dist/kurot/geom/Point.d.ts.map +1 -0
- package/dist/kurot/geom/Point.js +73 -0
- package/dist/kurot/geom/Point.js.map +1 -0
- package/dist/kurot/geom/Rectangle.d.ts +47 -0
- package/dist/kurot/geom/Rectangle.d.ts.map +1 -0
- package/dist/kurot/geom/Rectangle.js +174 -0
- package/dist/kurot/geom/Rectangle.js.map +1 -0
- package/dist/kurot/geom/index.d.ts +4 -0
- package/dist/kurot/geom/index.d.ts.map +1 -0
- package/dist/kurot/geom/index.js +4 -0
- package/dist/kurot/geom/index.js.map +1 -0
- package/dist/kurot/localStorage/index.d.ts +2 -0
- package/dist/kurot/localStorage/index.d.ts.map +1 -0
- package/dist/kurot/localStorage/index.js +2 -0
- package/dist/kurot/localStorage/index.js.map +1 -0
- package/dist/kurot/localStorage/localStorage.d.ts +5 -0
- package/dist/kurot/localStorage/localStorage.d.ts.map +1 -0
- package/dist/kurot/localStorage/localStorage.js +19 -0
- package/dist/kurot/localStorage/localStorage.js.map +1 -0
- package/dist/kurot/media/Sound.d.ts +33 -0
- package/dist/kurot/media/Sound.d.ts.map +1 -0
- package/dist/kurot/media/Sound.js +163 -0
- package/dist/kurot/media/Sound.js.map +1 -0
- package/dist/kurot/media/SoundChannel.d.ts +28 -0
- package/dist/kurot/media/SoundChannel.d.ts.map +1 -0
- package/dist/kurot/media/SoundChannel.js +117 -0
- package/dist/kurot/media/SoundChannel.js.map +1 -0
- package/dist/kurot/media/Video.d.ts +50 -0
- package/dist/kurot/media/Video.d.ts.map +1 -0
- package/dist/kurot/media/Video.js +242 -0
- package/dist/kurot/media/Video.js.map +1 -0
- package/dist/kurot/media/index.d.ts +4 -0
- package/dist/kurot/media/index.d.ts.map +1 -0
- package/dist/kurot/media/index.js +4 -0
- package/dist/kurot/media/index.js.map +1 -0
- package/dist/kurot/net/HttpMethod.d.ts +12 -0
- package/dist/kurot/net/HttpMethod.d.ts.map +1 -0
- package/dist/kurot/net/HttpMethod.js +10 -0
- package/dist/kurot/net/HttpMethod.js.map +1 -0
- package/dist/kurot/net/HttpRequest.d.ts +69 -0
- package/dist/kurot/net/HttpRequest.d.ts.map +1 -0
- package/dist/kurot/net/HttpRequest.js +121 -0
- package/dist/kurot/net/HttpRequest.js.map +1 -0
- package/dist/kurot/net/HttpResponseType.d.ts +12 -0
- package/dist/kurot/net/HttpResponseType.d.ts.map +1 -0
- package/dist/kurot/net/HttpResponseType.js +10 -0
- package/dist/kurot/net/HttpResponseType.js.map +1 -0
- package/dist/kurot/net/ImageLoader.d.ts +34 -0
- package/dist/kurot/net/ImageLoader.d.ts.map +1 -0
- package/dist/kurot/net/ImageLoader.js +54 -0
- package/dist/kurot/net/ImageLoader.js.map +1 -0
- package/dist/kurot/net/index.d.ts +7 -0
- package/dist/kurot/net/index.d.ts.map +1 -0
- package/dist/kurot/net/index.js +5 -0
- package/dist/kurot/net/index.js.map +1 -0
- package/dist/kurot/player/KurotOptions.d.ts +25 -0
- package/dist/kurot/player/KurotOptions.d.ts.map +1 -0
- package/dist/kurot/player/KurotOptions.js +2 -0
- package/dist/kurot/player/KurotOptions.js.map +1 -0
- package/dist/kurot/player/Player.d.ts +45 -0
- package/dist/kurot/player/Player.d.ts.map +1 -0
- package/dist/kurot/player/Player.js +158 -0
- package/dist/kurot/player/Player.js.map +1 -0
- package/dist/kurot/player/RenderPipe.d.ts +33 -0
- package/dist/kurot/player/RenderPipe.d.ts.map +1 -0
- package/dist/kurot/player/RenderPipe.js +2 -0
- package/dist/kurot/player/RenderPipe.js.map +1 -0
- package/dist/kurot/player/ScreenAdapter.d.ts +29 -0
- package/dist/kurot/player/ScreenAdapter.d.ts.map +1 -0
- package/dist/kurot/player/ScreenAdapter.js +127 -0
- package/dist/kurot/player/ScreenAdapter.js.map +1 -0
- package/dist/kurot/player/SystemTicker.d.ts +63 -0
- package/dist/kurot/player/SystemTicker.d.ts.map +1 -0
- package/dist/kurot/player/SystemTicker.js +209 -0
- package/dist/kurot/player/SystemTicker.js.map +1 -0
- package/dist/kurot/player/TouchHandler.d.ts +39 -0
- package/dist/kurot/player/TouchHandler.d.ts.map +1 -0
- package/dist/kurot/player/TouchHandler.js +152 -0
- package/dist/kurot/player/TouchHandler.js.map +1 -0
- package/dist/kurot/player/canvas/CanvasRenderer.d.ts +50 -0
- package/dist/kurot/player/canvas/CanvasRenderer.d.ts.map +1 -0
- package/dist/kurot/player/canvas/CanvasRenderer.js +811 -0
- package/dist/kurot/player/canvas/CanvasRenderer.js.map +1 -0
- package/dist/kurot/player/canvas/DisplayList.d.ts +36 -0
- package/dist/kurot/player/canvas/DisplayList.d.ts.map +1 -0
- package/dist/kurot/player/canvas/DisplayList.js +100 -0
- package/dist/kurot/player/canvas/DisplayList.js.map +1 -0
- package/dist/kurot/player/canvas/RenderBuffer.d.ts +35 -0
- package/dist/kurot/player/canvas/RenderBuffer.d.ts.map +1 -0
- package/dist/kurot/player/canvas/RenderBuffer.js +83 -0
- package/dist/kurot/player/canvas/RenderBuffer.js.map +1 -0
- package/dist/kurot/player/canvas/index.d.ts +4 -0
- package/dist/kurot/player/canvas/index.d.ts.map +1 -0
- package/dist/kurot/player/canvas/index.js +4 -0
- package/dist/kurot/player/canvas/index.js.map +1 -0
- package/dist/kurot/player/createPlayer.d.ts +36 -0
- package/dist/kurot/player/createPlayer.d.ts.map +1 -0
- package/dist/kurot/player/createPlayer.js +83 -0
- package/dist/kurot/player/createPlayer.js.map +1 -0
- package/dist/kurot/player/index.d.ts +11 -0
- package/dist/kurot/player/index.d.ts.map +1 -0
- package/dist/kurot/player/index.js +14 -0
- package/dist/kurot/player/index.js.map +1 -0
- package/dist/kurot/player/webgl/InstructionSet.d.ts +61 -0
- package/dist/kurot/player/webgl/InstructionSet.d.ts.map +1 -0
- package/dist/kurot/player/webgl/InstructionSet.js +84 -0
- package/dist/kurot/player/webgl/InstructionSet.js.map +1 -0
- package/dist/kurot/player/webgl/MultiTextureBatcher.d.ts +39 -0
- package/dist/kurot/player/webgl/MultiTextureBatcher.d.ts.map +1 -0
- package/dist/kurot/player/webgl/MultiTextureBatcher.js +63 -0
- package/dist/kurot/player/webgl/MultiTextureBatcher.js.map +1 -0
- package/dist/kurot/player/webgl/WebGLDrawCmdManager.d.ts +57 -0
- package/dist/kurot/player/webgl/WebGLDrawCmdManager.d.ts.map +1 -0
- package/dist/kurot/player/webgl/WebGLDrawCmdManager.js +197 -0
- package/dist/kurot/player/webgl/WebGLDrawCmdManager.js.map +1 -0
- package/dist/kurot/player/webgl/WebGLProgram.d.ts +15 -0
- package/dist/kurot/player/webgl/WebGLProgram.d.ts.map +1 -0
- package/dist/kurot/player/webgl/WebGLProgram.js +32 -0
- package/dist/kurot/player/webgl/WebGLProgram.js.map +1 -0
- package/dist/kurot/player/webgl/WebGLRenderBuffer.d.ts +57 -0
- package/dist/kurot/player/webgl/WebGLRenderBuffer.d.ts.map +1 -0
- package/dist/kurot/player/webgl/WebGLRenderBuffer.js +254 -0
- package/dist/kurot/player/webgl/WebGLRenderBuffer.js.map +1 -0
- package/dist/kurot/player/webgl/WebGLRenderContext.d.ts +128 -0
- package/dist/kurot/player/webgl/WebGLRenderContext.d.ts.map +1 -0
- package/dist/kurot/player/webgl/WebGLRenderContext.js +933 -0
- package/dist/kurot/player/webgl/WebGLRenderContext.js.map +1 -0
- package/dist/kurot/player/webgl/WebGLRenderTarget.d.ts +20 -0
- package/dist/kurot/player/webgl/WebGLRenderTarget.d.ts.map +1 -0
- package/dist/kurot/player/webgl/WebGLRenderTarget.js +90 -0
- package/dist/kurot/player/webgl/WebGLRenderTarget.js.map +1 -0
- package/dist/kurot/player/webgl/WebGLRenderer.d.ts +208 -0
- package/dist/kurot/player/webgl/WebGLRenderer.d.ts.map +1 -0
- package/dist/kurot/player/webgl/WebGLRenderer.js +921 -0
- package/dist/kurot/player/webgl/WebGLRenderer.js.map +1 -0
- package/dist/kurot/player/webgl/WebGLUtils.d.ts +17 -0
- package/dist/kurot/player/webgl/WebGLUtils.d.ts.map +1 -0
- package/dist/kurot/player/webgl/WebGLUtils.js +56 -0
- package/dist/kurot/player/webgl/WebGLUtils.js.map +1 -0
- package/dist/kurot/player/webgl/WebGLVertexArrayObject.d.ts +39 -0
- package/dist/kurot/player/webgl/WebGLVertexArrayObject.d.ts.map +1 -0
- package/dist/kurot/player/webgl/WebGLVertexArrayObject.js +375 -0
- package/dist/kurot/player/webgl/WebGLVertexArrayObject.js.map +1 -0
- package/dist/kurot/player/webgl/index.d.ts +11 -0
- package/dist/kurot/player/webgl/index.d.ts.map +1 -0
- package/dist/kurot/player/webgl/index.js +11 -0
- package/dist/kurot/player/webgl/index.js.map +1 -0
- package/dist/kurot/player/webgl/pipes/BitmapPipe.d.ts +35 -0
- package/dist/kurot/player/webgl/pipes/BitmapPipe.d.ts.map +1 -0
- package/dist/kurot/player/webgl/pipes/BitmapPipe.js +130 -0
- package/dist/kurot/player/webgl/pipes/BitmapPipe.js.map +1 -0
- package/dist/kurot/player/webgl/pipes/FilterPipe.d.ts +68 -0
- package/dist/kurot/player/webgl/pipes/FilterPipe.d.ts.map +1 -0
- package/dist/kurot/player/webgl/pipes/FilterPipe.js +176 -0
- package/dist/kurot/player/webgl/pipes/FilterPipe.js.map +1 -0
- package/dist/kurot/player/webgl/pipes/GraphicsPipe.d.ts +38 -0
- package/dist/kurot/player/webgl/pipes/GraphicsPipe.d.ts.map +1 -0
- package/dist/kurot/player/webgl/pipes/GraphicsPipe.js +165 -0
- package/dist/kurot/player/webgl/pipes/GraphicsPipe.js.map +1 -0
- package/dist/kurot/player/webgl/pipes/MaskPipe.d.ts +58 -0
- package/dist/kurot/player/webgl/pipes/MaskPipe.d.ts.map +1 -0
- package/dist/kurot/player/webgl/pipes/MaskPipe.js +206 -0
- package/dist/kurot/player/webgl/pipes/MaskPipe.js.map +1 -0
- package/dist/kurot/player/webgl/pipes/MeshPipe.d.ts +22 -0
- package/dist/kurot/player/webgl/pipes/MeshPipe.d.ts.map +1 -0
- package/dist/kurot/player/webgl/pipes/MeshPipe.js +50 -0
- package/dist/kurot/player/webgl/pipes/MeshPipe.js.map +1 -0
- package/dist/kurot/player/webgl/pipes/ParticlePipe.d.ts +23 -0
- package/dist/kurot/player/webgl/pipes/ParticlePipe.d.ts.map +1 -0
- package/dist/kurot/player/webgl/pipes/ParticlePipe.js +48 -0
- package/dist/kurot/player/webgl/pipes/ParticlePipe.js.map +1 -0
- package/dist/kurot/player/webgl/pipes/TextPipe.d.ts +54 -0
- package/dist/kurot/player/webgl/pipes/TextPipe.d.ts.map +1 -0
- package/dist/kurot/player/webgl/pipes/TextPipe.js +201 -0
- package/dist/kurot/player/webgl/pipes/TextPipe.js.map +1 -0
- package/dist/kurot/player/webgl/pipes/index.d.ts +8 -0
- package/dist/kurot/player/webgl/pipes/index.d.ts.map +1 -0
- package/dist/kurot/player/webgl/pipes/index.js +8 -0
- package/dist/kurot/player/webgl/pipes/index.js.map +1 -0
- package/dist/kurot/player/webgl/shaders/ShaderLib.d.ts +23 -0
- package/dist/kurot/player/webgl/shaders/ShaderLib.d.ts.map +1 -0
- package/dist/kurot/player/webgl/shaders/ShaderLib.js +263 -0
- package/dist/kurot/player/webgl/shaders/ShaderLib.js.map +1 -0
- package/dist/kurot/player/webgl/shaders/ShaderLib2.d.ts +23 -0
- package/dist/kurot/player/webgl/shaders/ShaderLib2.d.ts.map +1 -0
- package/dist/kurot/player/webgl/shaders/ShaderLib2.js +280 -0
- package/dist/kurot/player/webgl/shaders/ShaderLib2.js.map +1 -0
- package/dist/kurot/player/webgl/shaders/index.d.ts +5 -0
- package/dist/kurot/player/webgl/shaders/index.d.ts.map +1 -0
- package/dist/kurot/player/webgl/shaders/index.js +5 -0
- package/dist/kurot/player/webgl/shaders/index.js.map +1 -0
- package/dist/kurot/resource/Resource.d.ts +126 -0
- package/dist/kurot/resource/Resource.d.ts.map +1 -0
- package/dist/kurot/resource/Resource.js +377 -0
- package/dist/kurot/resource/Resource.js.map +1 -0
- package/dist/kurot/resource/ResourceConfig.d.ts +71 -0
- package/dist/kurot/resource/ResourceConfig.d.ts.map +1 -0
- package/dist/kurot/resource/ResourceConfig.js +146 -0
- package/dist/kurot/resource/ResourceConfig.js.map +1 -0
- package/dist/kurot/resource/ResourceEvent.d.ts +29 -0
- package/dist/kurot/resource/ResourceEvent.d.ts.map +1 -0
- package/dist/kurot/resource/ResourceEvent.js +12 -0
- package/dist/kurot/resource/ResourceEvent.js.map +1 -0
- package/dist/kurot/resource/ResourceItem.d.ts +24 -0
- package/dist/kurot/resource/ResourceItem.d.ts.map +1 -0
- package/dist/kurot/resource/ResourceItem.js +29 -0
- package/dist/kurot/resource/ResourceItem.js.map +1 -0
- package/dist/kurot/resource/ResourceLoader.d.ts +73 -0
- package/dist/kurot/resource/ResourceLoader.d.ts.map +1 -0
- package/dist/kurot/resource/ResourceLoader.js +174 -0
- package/dist/kurot/resource/ResourceLoader.js.map +1 -0
- package/dist/kurot/resource/analyzers/AnalyzerBase.d.ts +31 -0
- package/dist/kurot/resource/analyzers/AnalyzerBase.d.ts.map +1 -0
- package/dist/kurot/resource/analyzers/AnalyzerBase.js +38 -0
- package/dist/kurot/resource/analyzers/AnalyzerBase.js.map +1 -0
- package/dist/kurot/resource/analyzers/ImageAnalyzer.d.ts +13 -0
- package/dist/kurot/resource/analyzers/ImageAnalyzer.d.ts.map +1 -0
- package/dist/kurot/resource/analyzers/ImageAnalyzer.js +54 -0
- package/dist/kurot/resource/analyzers/ImageAnalyzer.js.map +1 -0
- package/dist/kurot/resource/analyzers/JsonAnalyzer.d.ts +12 -0
- package/dist/kurot/resource/analyzers/JsonAnalyzer.d.ts.map +1 -0
- package/dist/kurot/resource/analyzers/JsonAnalyzer.js +54 -0
- package/dist/kurot/resource/analyzers/JsonAnalyzer.js.map +1 -0
- package/dist/kurot/resource/analyzers/SheetAnalyzer.d.ts +32 -0
- package/dist/kurot/resource/analyzers/SheetAnalyzer.d.ts.map +1 -0
- package/dist/kurot/resource/analyzers/SheetAnalyzer.js +182 -0
- package/dist/kurot/resource/analyzers/SheetAnalyzer.js.map +1 -0
- package/dist/kurot/resource/analyzers/SoundAnalyzer.d.ts +13 -0
- package/dist/kurot/resource/analyzers/SoundAnalyzer.d.ts.map +1 -0
- package/dist/kurot/resource/analyzers/SoundAnalyzer.js +45 -0
- package/dist/kurot/resource/analyzers/SoundAnalyzer.js.map +1 -0
- package/dist/kurot/resource/analyzers/TextAnalyzer.d.ts +12 -0
- package/dist/kurot/resource/analyzers/TextAnalyzer.d.ts.map +1 -0
- package/dist/kurot/resource/analyzers/TextAnalyzer.js +49 -0
- package/dist/kurot/resource/analyzers/TextAnalyzer.js.map +1 -0
- package/dist/kurot/resource/analyzers/index.d.ts +7 -0
- package/dist/kurot/resource/analyzers/index.d.ts.map +1 -0
- package/dist/kurot/resource/analyzers/index.js +7 -0
- package/dist/kurot/resource/analyzers/index.js.map +1 -0
- package/dist/kurot/resource/index.d.ts +15 -0
- package/dist/kurot/resource/index.d.ts.map +1 -0
- package/dist/kurot/resource/index.js +15 -0
- package/dist/kurot/resource/index.js.map +1 -0
- package/dist/kurot/system/Capabilities.d.ts +46 -0
- package/dist/kurot/system/Capabilities.d.ts.map +1 -0
- package/dist/kurot/system/Capabilities.js +100 -0
- package/dist/kurot/system/Capabilities.js.map +1 -0
- package/dist/kurot/system/index.d.ts +2 -0
- package/dist/kurot/system/index.d.ts.map +1 -0
- package/dist/kurot/system/index.js +2 -0
- package/dist/kurot/system/index.js.map +1 -0
- package/dist/kurot/text/BitmapFont.d.ts +31 -0
- package/dist/kurot/text/BitmapFont.d.ts.map +1 -0
- package/dist/kurot/text/BitmapFont.js +86 -0
- package/dist/kurot/text/BitmapFont.js.map +1 -0
- package/dist/kurot/text/BitmapText.d.ts +58 -0
- package/dist/kurot/text/BitmapText.d.ts.map +1 -0
- package/dist/kurot/text/BitmapText.js +245 -0
- package/dist/kurot/text/BitmapText.js.map +1 -0
- package/dist/kurot/text/HtmlTextParser.d.ts +14 -0
- package/dist/kurot/text/HtmlTextParser.d.ts.map +1 -0
- package/dist/kurot/text/HtmlTextParser.js +147 -0
- package/dist/kurot/text/HtmlTextParser.js.map +1 -0
- package/dist/kurot/text/InputController.d.ts +29 -0
- package/dist/kurot/text/InputController.d.ts.map +1 -0
- package/dist/kurot/text/InputController.js +131 -0
- package/dist/kurot/text/InputController.js.map +1 -0
- package/dist/kurot/text/StageText.d.ts +51 -0
- package/dist/kurot/text/StageText.d.ts.map +1 -0
- package/dist/kurot/text/StageText.js +324 -0
- package/dist/kurot/text/StageText.js.map +1 -0
- package/dist/kurot/text/TextField.d.ts +149 -0
- package/dist/kurot/text/TextField.d.ts.map +1 -0
- package/dist/kurot/text/TextField.js +734 -0
- package/dist/kurot/text/TextField.js.map +1 -0
- package/dist/kurot/text/TextMeasurer.d.ts +9 -0
- package/dist/kurot/text/TextMeasurer.d.ts.map +1 -0
- package/dist/kurot/text/TextMeasurer.js +36 -0
- package/dist/kurot/text/TextMeasurer.js.map +1 -0
- package/dist/kurot/text/WordWrap.d.ts +29 -0
- package/dist/kurot/text/WordWrap.d.ts.map +1 -0
- package/dist/kurot/text/WordWrap.js +110 -0
- package/dist/kurot/text/WordWrap.js.map +1 -0
- package/dist/kurot/text/enums/HorizontalAlign.d.ts +9 -0
- package/dist/kurot/text/enums/HorizontalAlign.d.ts.map +1 -0
- package/dist/kurot/text/enums/HorizontalAlign.js +8 -0
- package/dist/kurot/text/enums/HorizontalAlign.js.map +1 -0
- package/dist/kurot/text/enums/TextFieldInputType.d.ts +7 -0
- package/dist/kurot/text/enums/TextFieldInputType.d.ts.map +1 -0
- package/dist/kurot/text/enums/TextFieldInputType.js +6 -0
- package/dist/kurot/text/enums/TextFieldInputType.js.map +1 -0
- package/dist/kurot/text/enums/TextFieldType.d.ts +6 -0
- package/dist/kurot/text/enums/TextFieldType.d.ts.map +1 -0
- package/dist/kurot/text/enums/TextFieldType.js +5 -0
- package/dist/kurot/text/enums/TextFieldType.js.map +1 -0
- package/dist/kurot/text/enums/VerticalAlign.d.ts +9 -0
- package/dist/kurot/text/enums/VerticalAlign.d.ts.map +1 -0
- package/dist/kurot/text/enums/VerticalAlign.js +8 -0
- package/dist/kurot/text/enums/VerticalAlign.js.map +1 -0
- package/dist/kurot/text/enums/index.d.ts +5 -0
- package/dist/kurot/text/enums/index.d.ts.map +1 -0
- package/dist/kurot/text/enums/index.js +5 -0
- package/dist/kurot/text/enums/index.js.map +1 -0
- package/dist/kurot/text/index.d.ts +14 -0
- package/dist/kurot/text/index.d.ts.map +1 -0
- package/dist/kurot/text/index.js +13 -0
- package/dist/kurot/text/index.js.map +1 -0
- package/dist/kurot/text/types/ITextElement.d.ts +31 -0
- package/dist/kurot/text/types/ITextElement.d.ts.map +1 -0
- package/dist/kurot/text/types/ITextElement.js +2 -0
- package/dist/kurot/text/types/ITextElement.js.map +1 -0
- package/dist/kurot/text/types/index.d.ts +2 -0
- package/dist/kurot/text/types/index.d.ts.map +1 -0
- package/dist/kurot/text/types/index.js +2 -0
- package/dist/kurot/text/types/index.js.map +1 -0
- package/dist/kurot/utils/Base64Util.d.ts +20 -0
- package/dist/kurot/utils/Base64Util.d.ts.map +1 -0
- package/dist/kurot/utils/Base64Util.js +41 -0
- package/dist/kurot/utils/Base64Util.js.map +1 -0
- package/dist/kurot/utils/ByteArray.d.ts +65 -0
- package/dist/kurot/utils/ByteArray.d.ts.map +1 -0
- package/dist/kurot/utils/ByteArray.js +300 -0
- package/dist/kurot/utils/ByteArray.js.map +1 -0
- package/dist/kurot/utils/DebugLog.d.ts +9 -0
- package/dist/kurot/utils/DebugLog.d.ts.map +1 -0
- package/dist/kurot/utils/DebugLog.js +25 -0
- package/dist/kurot/utils/DebugLog.js.map +1 -0
- package/dist/kurot/utils/FontManager.d.ts +11 -0
- package/dist/kurot/utils/FontManager.d.ts.map +1 -0
- package/dist/kurot/utils/FontManager.js +39 -0
- package/dist/kurot/utils/FontManager.js.map +1 -0
- package/dist/kurot/utils/Logger.d.ts +16 -0
- package/dist/kurot/utils/Logger.d.ts.map +1 -0
- package/dist/kurot/utils/Logger.js +26 -0
- package/dist/kurot/utils/Logger.js.map +1 -0
- package/dist/kurot/utils/NumberUtils.d.ts +15 -0
- package/dist/kurot/utils/NumberUtils.d.ts.map +1 -0
- package/dist/kurot/utils/NumberUtils.js +60 -0
- package/dist/kurot/utils/NumberUtils.js.map +1 -0
- package/dist/kurot/utils/Timer.d.ts +28 -0
- package/dist/kurot/utils/Timer.d.ts.map +1 -0
- package/dist/kurot/utils/Timer.js +67 -0
- package/dist/kurot/utils/Timer.js.map +1 -0
- package/dist/kurot/utils/index.d.ts +9 -0
- package/dist/kurot/utils/index.d.ts.map +1 -0
- package/dist/kurot/utils/index.js +9 -0
- package/dist/kurot/utils/index.js.map +1 -0
- package/dist/kurot/utils/toColorString.d.ts +2 -0
- package/dist/kurot/utils/toColorString.d.ts.map +1 -0
- package/dist/kurot/utils/toColorString.js +5 -0
- package/dist/kurot/utils/toColorString.js.map +1 -0
- package/package.json +56 -0
|
@@ -0,0 +1,921 @@
|
|
|
1
|
+
import { DisplayObjectContainer } from '../../display/DisplayObjectContainer.js';
|
|
2
|
+
import { Matrix } from '../../geom/Matrix.js';
|
|
3
|
+
import { CanvasRenderer } from '../canvas/CanvasRenderer.js';
|
|
4
|
+
import { InstructionSet } from './InstructionSet.js';
|
|
5
|
+
import { BitmapPipe } from './pipes/BitmapPipe.js';
|
|
6
|
+
import { GraphicsPipe } from './pipes/GraphicsPipe.js';
|
|
7
|
+
import { MeshPipe } from './pipes/MeshPipe.js';
|
|
8
|
+
import { FilterPipe } from './pipes/FilterPipe.js';
|
|
9
|
+
import { MaskPipe } from './pipes/MaskPipe.js';
|
|
10
|
+
import { TextPipe } from './pipes/TextPipe.js';
|
|
11
|
+
import { ParticlePipe } from './pipes/ParticlePipe.js';
|
|
12
|
+
import { WebGLRenderBuffer } from './WebGLRenderBuffer.js';
|
|
13
|
+
const STAGE_BUILD_OPTIONS = { isStage: true };
|
|
14
|
+
const MASK_BUILD_OPTIONS = { inlineRenderGroups: true };
|
|
15
|
+
// ── WebGLRenderer ─────────────────────────────────────────────────────────────
|
|
16
|
+
/**
|
|
17
|
+
* Two-phase WebGL renderer inspired by Pixi.js 8's RenderPipe / InstructionSet pattern.
|
|
18
|
+
*
|
|
19
|
+
* Phase A — Build (only when structureDirty):
|
|
20
|
+
* Traverse the DisplayObject tree and produce a flat InstructionSet.
|
|
21
|
+
* Each instruction captures the object reference + transform snapshot.
|
|
22
|
+
*
|
|
23
|
+
* Phase B — Execute (every frame):
|
|
24
|
+
* Walk the InstructionSet and dispatch each instruction to its pipe.
|
|
25
|
+
* No scene-graph traversal happens here.
|
|
26
|
+
*
|
|
27
|
+
* When only data changes ($renderDirty but not structureDirty):
|
|
28
|
+
* Call pipe.updateRenderable() for each dirty object, then execute.
|
|
29
|
+
*/
|
|
30
|
+
export class WebGLRenderer {
|
|
31
|
+
// ── Pipes ─────────────────────────────────────────────────────────────────
|
|
32
|
+
_canvasRenderer = new CanvasRenderer();
|
|
33
|
+
_bitmapPipe;
|
|
34
|
+
_graphicsPipe;
|
|
35
|
+
_meshPipe;
|
|
36
|
+
_textPipe;
|
|
37
|
+
_filterPipe = new FilterPipe();
|
|
38
|
+
_maskPipe;
|
|
39
|
+
_particlePipe = new ParticlePipe();
|
|
40
|
+
// ── Instruction set ───────────────────────────────────────────────────────
|
|
41
|
+
_instructionSet = new InstructionSet();
|
|
42
|
+
// Scratch instruction sets used by nested mask-object renders.
|
|
43
|
+
_maskInstructionSets = [];
|
|
44
|
+
// Current mask-object rendering depth.
|
|
45
|
+
_maskInstructionDepth = 0;
|
|
46
|
+
_renderGroupSets = new WeakMap();
|
|
47
|
+
_renderGroupSetList = [];
|
|
48
|
+
// Tracks recursive render() depth. Currently render() is never called
|
|
49
|
+
// recursively (cacheAsBitmap uses an instruction-based path, RenderTexture
|
|
50
|
+
// uses CanvasRenderer), so this stays at 0 on entry / exit. The guard below
|
|
51
|
+
// (`if (this._nestLevel === 0)`) therefore fires on every render today.
|
|
52
|
+
// Kept so that a future WebGL cacheAsBitmap / drawToTexture that recurses
|
|
53
|
+
// through render() will only restore the root projection on the outermost
|
|
54
|
+
// call — restoring it on an inner call would corrupt the in-flight
|
|
55
|
+
// offscreen pass. DO NOT remove even though it looks unused.
|
|
56
|
+
_nestLevel = 0;
|
|
57
|
+
constructor() {
|
|
58
|
+
this._bitmapPipe = new BitmapPipe();
|
|
59
|
+
this._graphicsPipe = new GraphicsPipe(this._canvasRenderer);
|
|
60
|
+
this._meshPipe = new MeshPipe();
|
|
61
|
+
this._textPipe = new TextPipe(this._canvasRenderer);
|
|
62
|
+
this._maskPipe = new MaskPipe((obj, buffer, offsetX, offsetY) => {
|
|
63
|
+
this._renderMaskObject(obj, buffer, offsetX, offsetY);
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
// ── Public entry point ────────────────────────────────────────────────────
|
|
67
|
+
/**
|
|
68
|
+
* Release pooled instructions (filter/mask push/pop) back to their
|
|
69
|
+
* respective pipes before a rebuild discards `set`'s current contents.
|
|
70
|
+
*/
|
|
71
|
+
_releaseInstructions(set) {
|
|
72
|
+
for (let i = 0; i < set.instructionSize; i++) {
|
|
73
|
+
const inst = set.instructions[i];
|
|
74
|
+
switch (inst.renderPipeId) {
|
|
75
|
+
case 'filterPush':
|
|
76
|
+
FilterPipe.releasePush(inst);
|
|
77
|
+
break;
|
|
78
|
+
case 'filterPop':
|
|
79
|
+
FilterPipe.releasePop(inst);
|
|
80
|
+
break;
|
|
81
|
+
case 'maskPush':
|
|
82
|
+
MaskPipe.releasePush(inst);
|
|
83
|
+
break;
|
|
84
|
+
case 'maskPop':
|
|
85
|
+
MaskPipe.releasePop(inst);
|
|
86
|
+
break;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Render `displayObject` into `buffer` and return the number of draw calls
|
|
92
|
+
* issued. Rebuilds the instruction set when the scene structure is dirty,
|
|
93
|
+
* otherwise patches dirty renderables in place, then executes.
|
|
94
|
+
*/
|
|
95
|
+
render(displayObject, buffer, matrix) {
|
|
96
|
+
this._nestLevel++;
|
|
97
|
+
const ctx = buffer.context;
|
|
98
|
+
ctx.pushBuffer(buffer);
|
|
99
|
+
// Set (not multiply) the root transform so it doesn't accumulate across frames.
|
|
100
|
+
buffer.setTransform(matrix.a, matrix.b, matrix.c, matrix.d, 0, 0);
|
|
101
|
+
const set = this._instructionSet;
|
|
102
|
+
// ── Phase A: build instructions if scene structure changed ────────────
|
|
103
|
+
if (set.structureDirty) {
|
|
104
|
+
this._releaseInstructions(set);
|
|
105
|
+
set.reset();
|
|
106
|
+
buffer.globalAlpha = 1;
|
|
107
|
+
buffer.globalTintColor = 0xffffff;
|
|
108
|
+
this._buildInstructions(displayObject, set, buffer, matrix.tx, matrix.ty, STAGE_BUILD_OPTIONS);
|
|
109
|
+
set.structureDirty = false;
|
|
110
|
+
}
|
|
111
|
+
else {
|
|
112
|
+
// ── Partial update: patch GPU data for dirty renderables ──────────
|
|
113
|
+
this._updateDirtyRenderables(set);
|
|
114
|
+
this._prepareRenderGroups(set, buffer);
|
|
115
|
+
}
|
|
116
|
+
// ── Phase B: execute ──────────────────────────────────────────────────
|
|
117
|
+
this._executeInstructions(set, buffer);
|
|
118
|
+
ctx.flush();
|
|
119
|
+
const drawCalls = buffer.drawCalls;
|
|
120
|
+
buffer.onRenderFinish();
|
|
121
|
+
ctx.popBuffer();
|
|
122
|
+
// Reset to identity — clean slate for next frame.
|
|
123
|
+
buffer.setTransform(1, 0, 0, 1, 0, 0);
|
|
124
|
+
// Root $renderDirty is consumed after a full render pass.
|
|
125
|
+
displayObject.$renderDirty = false;
|
|
126
|
+
this._nestLevel--;
|
|
127
|
+
// Only the outermost render() restores the root buffer's projection /
|
|
128
|
+
// viewport. See _nestLevel comment for why this guard exists despite
|
|
129
|
+
// render() currently never recursing.
|
|
130
|
+
//
|
|
131
|
+
// What this call actually does: create()+release() cycles a scratch
|
|
132
|
+
// buffer through the pool, but its real effect is the pushBuffer /
|
|
133
|
+
// popBuffer pair inside WebGLRenderBuffer.resize(). That queues an
|
|
134
|
+
// activateBuffer command which, when flush() runs it, calls
|
|
135
|
+
// _activateBuffer() → onResize(), resetting the GL projection/viewport
|
|
136
|
+
// to the root canvas size. Without this, an in-frame offscreen buffer
|
|
137
|
+
// activation (filter / mask / cacheAsBitmap) leaves the projection set
|
|
138
|
+
// to the offscreen size, and the next frame's output is vertically
|
|
139
|
+
// offset. DO NOT delete as dead code — it is not dead.
|
|
140
|
+
if (this._nestLevel === 0) {
|
|
141
|
+
WebGLRenderBuffer.release(WebGLRenderBuffer.create(buffer.context, 0, 0));
|
|
142
|
+
}
|
|
143
|
+
return drawCalls;
|
|
144
|
+
}
|
|
145
|
+
// ── Phase A: build ────────────────────────────────────────────────────────
|
|
146
|
+
/**
|
|
147
|
+
* Recursively build render instructions for the display subtree rooted at
|
|
148
|
+
* `displayObject`, appending leaf/effect/group instructions into `set`.
|
|
149
|
+
*
|
|
150
|
+
* A `cacheAsBitmap` object is treated as a single opaque leaf: a synthetic
|
|
151
|
+
* `BitmapInstruction` backed by its DisplayList cache is emitted via
|
|
152
|
+
* `addLeaf` (not `add`), so an ancestor's later transform/alpha/tint
|
|
153
|
+
* change can still refresh this instruction's snapshot through the same
|
|
154
|
+
* `renderableIndex` path as ordinary leaves; the cache itself is refreshed
|
|
155
|
+
* lazily during the execute phase if dirty.
|
|
156
|
+
*
|
|
157
|
+
* A child with `isRenderGroup` is built into its own `InstructionSet` and
|
|
158
|
+
* emitted as a single `renderGroup` instruction in the parent set, rather
|
|
159
|
+
* than being inlined here.
|
|
160
|
+
*/
|
|
161
|
+
_buildInstructions(displayObject, set, buffer, offsetX, offsetY, options) {
|
|
162
|
+
const $displayList = displayObject.$displayList;
|
|
163
|
+
if ($displayList && !options?.isStage) {
|
|
164
|
+
const inst = this._makeCacheInstruction(displayObject, offsetX, offsetY, buffer);
|
|
165
|
+
if (inst)
|
|
166
|
+
set.addLeaf(inst);
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
const childOptions = options?.isStage
|
|
170
|
+
? options.inlineRenderGroups
|
|
171
|
+
? MASK_BUILD_OPTIONS
|
|
172
|
+
: undefined
|
|
173
|
+
: options;
|
|
174
|
+
// Emit self instruction (Bitmap / Shape / Sprite / Mesh).
|
|
175
|
+
this._buildLeaf(displayObject, set, buffer, offsetX, offsetY);
|
|
176
|
+
const $children = displayObject.$children;
|
|
177
|
+
if (!$children || $children.length === 0)
|
|
178
|
+
return;
|
|
179
|
+
for (const child of $children) {
|
|
180
|
+
if (child.$renderMode === 1 /* RenderMode.NONE */)
|
|
181
|
+
continue;
|
|
182
|
+
// Compute child transform.
|
|
183
|
+
let ox, oy;
|
|
184
|
+
let savedMatrix;
|
|
185
|
+
if (child.$useTranslate) {
|
|
186
|
+
const m = child.$getMatrix();
|
|
187
|
+
ox = offsetX + child.$x;
|
|
188
|
+
oy = offsetY + child.$y;
|
|
189
|
+
savedMatrix = Matrix.create();
|
|
190
|
+
savedMatrix.copyFrom(buffer.globalMatrix);
|
|
191
|
+
buffer.transform(m.a, m.b, m.c, m.d, ox, oy);
|
|
192
|
+
ox = -child.$anchorOffsetX;
|
|
193
|
+
oy = -child.$anchorOffsetY;
|
|
194
|
+
}
|
|
195
|
+
else {
|
|
196
|
+
ox = offsetX + child.$x - child.$anchorOffsetX;
|
|
197
|
+
oy = offsetY + child.$y - child.$anchorOffsetY;
|
|
198
|
+
}
|
|
199
|
+
const prevAlpha = buffer.globalAlpha;
|
|
200
|
+
if (child.$alpha !== 1)
|
|
201
|
+
buffer.globalAlpha *= child.$alpha;
|
|
202
|
+
const prevTint = buffer.globalTintColor;
|
|
203
|
+
if (child.$tintRGB !== 0xffffff)
|
|
204
|
+
buffer.globalTintColor = child.$tintRGB;
|
|
205
|
+
// Emit effect wrappers then recurse.
|
|
206
|
+
if (!childOptions?.inlineRenderGroups && child instanceof DisplayObjectContainer && child.isRenderGroup) {
|
|
207
|
+
this._buildRenderGroup(child, set, buffer, ox, oy);
|
|
208
|
+
}
|
|
209
|
+
else {
|
|
210
|
+
switch (child.$renderMode) {
|
|
211
|
+
case 2 /* RenderMode.FILTER */:
|
|
212
|
+
this._buildFilter(child, set, buffer, ox, oy, childOptions);
|
|
213
|
+
break;
|
|
214
|
+
case 3 /* RenderMode.CLIP */:
|
|
215
|
+
this._buildClip(child, set, buffer, ox, oy, childOptions);
|
|
216
|
+
break;
|
|
217
|
+
case 4 /* RenderMode.SCROLLRECT */:
|
|
218
|
+
this._buildScrollRect(child, set, buffer, ox, oy, childOptions);
|
|
219
|
+
break;
|
|
220
|
+
default:
|
|
221
|
+
this._buildInstructions(child, set, buffer, ox, oy, childOptions);
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
buffer.globalAlpha = prevAlpha;
|
|
225
|
+
buffer.globalTintColor = prevTint;
|
|
226
|
+
if (savedMatrix) {
|
|
227
|
+
buffer.globalMatrix.copyFrom(savedMatrix);
|
|
228
|
+
Matrix.release(savedMatrix);
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* Emit a leaf instruction (bitmap/mesh/shape/text/particle) for a single
|
|
234
|
+
* DisplayObject, based on its `$renderObjectType`. No-op for object types
|
|
235
|
+
* that don't map to a render pipe (e.g. plain containers).
|
|
236
|
+
*/
|
|
237
|
+
_buildLeaf(obj, set, buffer, offsetX, offsetY) {
|
|
238
|
+
const instruction = this._createLeafInstruction(obj, offsetX, offsetY);
|
|
239
|
+
if (!instruction)
|
|
240
|
+
return;
|
|
241
|
+
const transform = this._snapshotTransform(buffer, offsetX, offsetY);
|
|
242
|
+
set.addLeaf(Object.assign(instruction, { transform }));
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* Map one renderable DisplayObject to its pipe-specific leaf instruction.
|
|
246
|
+
* Returns undefined for plain containers and empty Sprite graphics.
|
|
247
|
+
*/
|
|
248
|
+
_createLeafInstruction(obj, offsetX, offsetY) {
|
|
249
|
+
switch (obj.$renderObjectType) {
|
|
250
|
+
case 2 /* RenderObjectType.MESH */:
|
|
251
|
+
return {
|
|
252
|
+
renderPipeId: 'mesh',
|
|
253
|
+
renderable: obj,
|
|
254
|
+
offsetX,
|
|
255
|
+
offsetY,
|
|
256
|
+
};
|
|
257
|
+
case 1 /* RenderObjectType.BITMAP */:
|
|
258
|
+
return {
|
|
259
|
+
renderPipeId: 'bitmap',
|
|
260
|
+
renderable: obj,
|
|
261
|
+
offsetX,
|
|
262
|
+
offsetY,
|
|
263
|
+
};
|
|
264
|
+
case 3 /* RenderObjectType.SHAPE */:
|
|
265
|
+
return {
|
|
266
|
+
renderPipeId: 'graphics',
|
|
267
|
+
renderable: obj,
|
|
268
|
+
graphics: obj.graphics,
|
|
269
|
+
offsetX,
|
|
270
|
+
offsetY,
|
|
271
|
+
};
|
|
272
|
+
case 5 /* RenderObjectType.TEXT */:
|
|
273
|
+
return {
|
|
274
|
+
renderPipeId: 'text',
|
|
275
|
+
renderable: obj,
|
|
276
|
+
offsetX,
|
|
277
|
+
offsetY,
|
|
278
|
+
};
|
|
279
|
+
case 4 /* RenderObjectType.SPRITE */: {
|
|
280
|
+
const sprite = obj;
|
|
281
|
+
if (sprite.graphics.commands.length === 0)
|
|
282
|
+
return undefined;
|
|
283
|
+
return {
|
|
284
|
+
renderPipeId: 'graphics',
|
|
285
|
+
renderable: obj,
|
|
286
|
+
graphics: sprite.graphics,
|
|
287
|
+
offsetX,
|
|
288
|
+
offsetY,
|
|
289
|
+
};
|
|
290
|
+
}
|
|
291
|
+
case 6 /* RenderObjectType.PARTICLE */:
|
|
292
|
+
return {
|
|
293
|
+
renderPipeId: 'particle',
|
|
294
|
+
renderable: obj,
|
|
295
|
+
offsetX,
|
|
296
|
+
offsetY,
|
|
297
|
+
};
|
|
298
|
+
default:
|
|
299
|
+
return undefined;
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
/**
|
|
303
|
+
* Wrap `obj`'s subtree with filter push/pop instructions. Skips the
|
|
304
|
+
* wrapper entirely (falls through to a plain build) if `obj` has no
|
|
305
|
+
* filters, since an empty push/pop pair would still incur an offscreen
|
|
306
|
+
* buffer allocation for nothing.
|
|
307
|
+
*/
|
|
308
|
+
_buildFilter(obj, set, buffer, offsetX, offsetY, options) {
|
|
309
|
+
const filters = obj.$filters;
|
|
310
|
+
if (!filters.length) {
|
|
311
|
+
this._buildInstructions(obj, set, buffer, offsetX, offsetY, options);
|
|
312
|
+
return;
|
|
313
|
+
}
|
|
314
|
+
const transform = this._snapshotTransform(buffer, offsetX, offsetY);
|
|
315
|
+
const push = Object.assign(FilterPipe.makePush(obj, filters, offsetX, offsetY), {
|
|
316
|
+
transform,
|
|
317
|
+
});
|
|
318
|
+
set.addIndexed(push);
|
|
319
|
+
this._buildInstructions(obj, set, buffer, offsetX, offsetY, options);
|
|
320
|
+
set.add(FilterPipe.makePop(obj, push));
|
|
321
|
+
}
|
|
322
|
+
/**
|
|
323
|
+
* Wrap `obj`'s subtree with mask push/pop instructions (`obj.$mask`).
|
|
324
|
+
*/
|
|
325
|
+
_buildClip(obj, set, buffer, offsetX, offsetY, options) {
|
|
326
|
+
const transform = this._snapshotTransform(buffer, offsetX, offsetY);
|
|
327
|
+
const push = Object.assign(MaskPipe.makePush(obj, offsetX, offsetY), { transform });
|
|
328
|
+
set.addIndexed(push);
|
|
329
|
+
this._buildInstructions(obj, set, buffer, offsetX, offsetY, options);
|
|
330
|
+
set.add(MaskPipe.makePop(obj, push));
|
|
331
|
+
}
|
|
332
|
+
/**
|
|
333
|
+
* Wrap `obj`'s subtree with a mask push/pop pair driven by its
|
|
334
|
+
* `$scrollRect`/`$maskRect`, using the mask pipe's scrollRect path
|
|
335
|
+
* (`isScrollRect`) rather than a full clip mask.
|
|
336
|
+
*/
|
|
337
|
+
_buildScrollRect(obj, set, buffer, offsetX, offsetY, options) {
|
|
338
|
+
const rect = obj.$scrollRect ?? obj.$maskRect;
|
|
339
|
+
if (!rect || rect.isEmpty())
|
|
340
|
+
return;
|
|
341
|
+
let ox = offsetX, oy = offsetY;
|
|
342
|
+
if (obj.$scrollRect) {
|
|
343
|
+
ox -= rect.x;
|
|
344
|
+
oy -= rect.y;
|
|
345
|
+
}
|
|
346
|
+
const transform = this._snapshotTransform(buffer, offsetX, offsetY);
|
|
347
|
+
const push = Object.assign(MaskPipe.makePush(obj, offsetX, offsetY), { transform });
|
|
348
|
+
// Tag as scrollRect so execute knows which path to take.
|
|
349
|
+
push.isScrollRect = true;
|
|
350
|
+
set.addIndexed(push);
|
|
351
|
+
this._buildInstructions(obj, set, buffer, ox, oy, options);
|
|
352
|
+
set.add(MaskPipe.makePop(obj, push));
|
|
353
|
+
}
|
|
354
|
+
/**
|
|
355
|
+
* Build a RenderGroup subtree into its own InstructionSet and emit a
|
|
356
|
+
* single `renderGroup` instruction into the parent set.
|
|
357
|
+
*
|
|
358
|
+
* The child set is rebuilt only when its own `structureDirty` flag is set,
|
|
359
|
+
* so changes inside the group never force a rebuild of the parent set.
|
|
360
|
+
*/
|
|
361
|
+
_buildRenderGroup(obj, parentSet, buffer, offsetX, offsetY) {
|
|
362
|
+
let groupSet = this._renderGroupSets.get(obj);
|
|
363
|
+
if (!groupSet) {
|
|
364
|
+
groupSet = new InstructionSet();
|
|
365
|
+
this._renderGroupSets.set(obj, groupSet);
|
|
366
|
+
this._renderGroupSetList.push(new WeakRef(obj));
|
|
367
|
+
}
|
|
368
|
+
if (groupSet.structureDirty) {
|
|
369
|
+
this._releaseInstructions(groupSet);
|
|
370
|
+
groupSet.reset();
|
|
371
|
+
this._buildInstructions(obj, groupSet, buffer, offsetX, offsetY);
|
|
372
|
+
groupSet.structureDirty = false;
|
|
373
|
+
}
|
|
374
|
+
else {
|
|
375
|
+
this._updateDirtyRenderables(groupSet);
|
|
376
|
+
}
|
|
377
|
+
const transform = this._snapshotTransform(buffer, offsetX, offsetY);
|
|
378
|
+
parentSet.addIndexed({
|
|
379
|
+
renderPipeId: 'renderGroup',
|
|
380
|
+
renderable: obj,
|
|
381
|
+
set: groupSet,
|
|
382
|
+
offsetX,
|
|
383
|
+
offsetY,
|
|
384
|
+
transform,
|
|
385
|
+
});
|
|
386
|
+
}
|
|
387
|
+
/**
|
|
388
|
+
* Build a `displayListCache` instruction for a `cacheAsBitmap` object.
|
|
389
|
+
* Returns `undefined` if the object has no `$displayList` cache.
|
|
390
|
+
*/
|
|
391
|
+
_makeCacheInstruction(obj, offsetX, offsetY, buffer) {
|
|
392
|
+
const $displayList = obj.$displayList;
|
|
393
|
+
if (!$displayList)
|
|
394
|
+
return undefined;
|
|
395
|
+
const transform = this._snapshotTransform(buffer, offsetX, offsetY);
|
|
396
|
+
return {
|
|
397
|
+
renderPipeId: 'displayListCache',
|
|
398
|
+
renderable: obj,
|
|
399
|
+
offsetX,
|
|
400
|
+
offsetY,
|
|
401
|
+
transform,
|
|
402
|
+
};
|
|
403
|
+
}
|
|
404
|
+
// ── Phase A helpers ───────────────────────────────────────────────────────
|
|
405
|
+
_snapshotTransform(buffer, offsetX, offsetY) {
|
|
406
|
+
const m = buffer.globalMatrix;
|
|
407
|
+
return {
|
|
408
|
+
a: m.a,
|
|
409
|
+
b: m.b,
|
|
410
|
+
c: m.c,
|
|
411
|
+
d: m.d,
|
|
412
|
+
tx: m.tx,
|
|
413
|
+
ty: m.ty,
|
|
414
|
+
offsetX,
|
|
415
|
+
offsetY,
|
|
416
|
+
alpha: buffer.globalAlpha,
|
|
417
|
+
tint: buffer.globalTintColor,
|
|
418
|
+
};
|
|
419
|
+
}
|
|
420
|
+
// ── Partial update ────────────────────────────────────────────────────────
|
|
421
|
+
/**
|
|
422
|
+
* Patch cached transform/alpha/tint snapshots for objects marked dirty
|
|
423
|
+
* since the last build, without forcing a full instruction rebuild.
|
|
424
|
+
*
|
|
425
|
+
* `set.renderableIndex.get(obj)` misses (returns `undefined`) in two
|
|
426
|
+
* distinct cases, both handled by recursing/flagging rather than
|
|
427
|
+
* refreshing directly:
|
|
428
|
+
* 1. `obj` is a plain container (or any non-leaf) whose own
|
|
429
|
+
* transform/alpha/tint changed. Containers never get a leaf
|
|
430
|
+
* instruction (see `_buildLeaf`'s switch — containers don't match any
|
|
431
|
+
* `RenderObjectType` case), so without recursing into descendants here,
|
|
432
|
+
* their cached snapshots would never be refreshed: Canvas re-walks the
|
|
433
|
+
* tree every frame and picks up new state for free, but WebGL's
|
|
434
|
+
* snapshot-based leaves would keep drawing at the old position
|
|
435
|
+
* indefinitely.
|
|
436
|
+
* 2. `obj` is a leaf-type object that was skipped during
|
|
437
|
+
* `_buildInstructions` because its graphics commands were empty at
|
|
438
|
+
* build time (e.g. a UI component whose Validator fills commands one
|
|
439
|
+
* frame later). If it now has graphics content, flag the set for a
|
|
440
|
+
* full rebuild so it gets an instruction.
|
|
441
|
+
*
|
|
442
|
+
* When a hit is found, the snapshot is rebuilt from the object's current
|
|
443
|
+
* world transform rather than `buffer.globalMatrix`, since that reflects
|
|
444
|
+
* the main buffer's current state, not this object's.
|
|
445
|
+
*/
|
|
446
|
+
_updateDirtyRenderables(set) {
|
|
447
|
+
for (let i = 0; i < set.dirtyRenderableCount; i++) {
|
|
448
|
+
const obj = set.dirtyRenderables[i];
|
|
449
|
+
const indices = set.renderableIndex.get(obj);
|
|
450
|
+
if (indices === undefined) {
|
|
451
|
+
if (obj.$children && obj.$children.length > 0) {
|
|
452
|
+
this._refreshDescendantTransforms(obj, set);
|
|
453
|
+
}
|
|
454
|
+
else if (this._hasGraphicsContent(obj)) {
|
|
455
|
+
set.structureDirty = true;
|
|
456
|
+
}
|
|
457
|
+
continue;
|
|
458
|
+
}
|
|
459
|
+
let isRenderGroupBoundary = false;
|
|
460
|
+
const count = typeof indices === 'number' ? 1 : indices.length;
|
|
461
|
+
for (let index = 0; index < count; index++) {
|
|
462
|
+
const idx = typeof indices === 'number' ? indices : indices[index];
|
|
463
|
+
const inst = set.instructions[idx];
|
|
464
|
+
if (!inst)
|
|
465
|
+
continue;
|
|
466
|
+
this._refreshInstructionTransform(obj, inst);
|
|
467
|
+
if (inst.renderPipeId === 'renderGroup')
|
|
468
|
+
isRenderGroupBoundary = true;
|
|
469
|
+
}
|
|
470
|
+
// A Sprite can render its own Graphics and also contain children. Its
|
|
471
|
+
// own indexed leaf must not prevent descendant snapshots from updating.
|
|
472
|
+
// A renderGroup instruction is the boundary in the parent set; its
|
|
473
|
+
// descendants belong to the group's independent set instead.
|
|
474
|
+
if (!isRenderGroupBoundary && obj.$children && obj.$children.length > 0) {
|
|
475
|
+
this._refreshDescendantTransforms(obj, set);
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
set.clearDirtyRenderables();
|
|
479
|
+
}
|
|
480
|
+
/**
|
|
481
|
+
* Process dirty or structurally changed nested RenderGroup sets even when
|
|
482
|
+
* the root InstructionSet remains stable.
|
|
483
|
+
*/
|
|
484
|
+
_prepareRenderGroups(set, buffer) {
|
|
485
|
+
for (let i = 0; i < set.instructionSize; i++) {
|
|
486
|
+
const inst = set.instructions[i];
|
|
487
|
+
if (inst.renderPipeId !== 'renderGroup')
|
|
488
|
+
continue;
|
|
489
|
+
const group = inst;
|
|
490
|
+
const groupSet = group.set;
|
|
491
|
+
if (groupSet.structureDirty) {
|
|
492
|
+
const savedMatrix = Matrix.create();
|
|
493
|
+
savedMatrix.copyFrom(buffer.globalMatrix);
|
|
494
|
+
const savedAlpha = buffer.globalAlpha;
|
|
495
|
+
const savedTint = buffer.globalTintColor;
|
|
496
|
+
try {
|
|
497
|
+
this._applyTransform(buffer, group.transform);
|
|
498
|
+
this._releaseInstructions(groupSet);
|
|
499
|
+
groupSet.reset();
|
|
500
|
+
this._buildInstructions(group.renderable, groupSet, buffer, 0, 0);
|
|
501
|
+
groupSet.structureDirty = false;
|
|
502
|
+
}
|
|
503
|
+
finally {
|
|
504
|
+
buffer.globalMatrix.copyFrom(savedMatrix);
|
|
505
|
+
buffer.globalAlpha = savedAlpha;
|
|
506
|
+
buffer.globalTintColor = savedTint;
|
|
507
|
+
Matrix.release(savedMatrix);
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
else {
|
|
511
|
+
this._updateDirtyRenderables(groupSet);
|
|
512
|
+
}
|
|
513
|
+
this._prepareRenderGroups(groupSet, buffer);
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
/**
|
|
517
|
+
* Recursively refresh the transform snapshot of every descendant leaf
|
|
518
|
+
* instruction under `obj`. Used when an ancestor container's own
|
|
519
|
+
* transform/alpha/tint changed — the container itself has no instruction,
|
|
520
|
+
* but its descendants' cached snapshots are now stale and must be patched
|
|
521
|
+
* without forcing a full structural rebuild.
|
|
522
|
+
*
|
|
523
|
+
* Stops descending into a subtree once it hits a nested RenderGroup —
|
|
524
|
+
* that subtree owns its own InstructionSet and is refreshed independently
|
|
525
|
+
* (see markRenderableDirty's RenderGroup routing), so walking into it here
|
|
526
|
+
* would refresh against the wrong InstructionSet.
|
|
527
|
+
*/
|
|
528
|
+
_refreshDescendantTransforms(obj, set) {
|
|
529
|
+
const children = obj.$children;
|
|
530
|
+
if (!children)
|
|
531
|
+
return;
|
|
532
|
+
for (const child of children) {
|
|
533
|
+
child.$worldAlpha = obj.$worldAlpha * child.$alpha;
|
|
534
|
+
child.$worldTint = child.$tintRGB !== 0xffffff ? child.$tintRGB : obj.$worldTint;
|
|
535
|
+
const indices = set.renderableIndex.get(child);
|
|
536
|
+
if (indices !== undefined) {
|
|
537
|
+
const count = typeof indices === 'number' ? 1 : indices.length;
|
|
538
|
+
for (let index = 0; index < count; index++) {
|
|
539
|
+
const idx = typeof indices === 'number' ? indices : indices[index];
|
|
540
|
+
const inst = set.instructions[idx];
|
|
541
|
+
if (inst)
|
|
542
|
+
this._refreshInstructionTransform(child, inst);
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
if (child instanceof DisplayObjectContainer && child.isRenderGroup) {
|
|
546
|
+
const groupSet = this._renderGroupSets.get(child);
|
|
547
|
+
if (groupSet && !groupSet.structureDirty)
|
|
548
|
+
groupSet.markRenderableDirty(child);
|
|
549
|
+
continue;
|
|
550
|
+
}
|
|
551
|
+
if (child.$children && child.$children.length > 0) {
|
|
552
|
+
this._refreshDescendantTransforms(child, set);
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
/**
|
|
557
|
+
* Recompute the transform snapshot for a leaf instruction from the object's
|
|
558
|
+
* current concatenated matrix and cached world alpha/tint.
|
|
559
|
+
*/
|
|
560
|
+
_refreshInstructionTransform(obj, inst) {
|
|
561
|
+
const cm = obj.$getConcatenatedMatrix();
|
|
562
|
+
const t = inst.transform;
|
|
563
|
+
t.a = cm.a;
|
|
564
|
+
t.b = cm.b;
|
|
565
|
+
t.c = cm.c;
|
|
566
|
+
t.d = cm.d;
|
|
567
|
+
t.tx = cm.tx;
|
|
568
|
+
t.ty = cm.ty;
|
|
569
|
+
t.offsetX = 0;
|
|
570
|
+
t.offsetY = 0;
|
|
571
|
+
t.alpha = obj.$worldAlpha;
|
|
572
|
+
t.tint = obj.$worldTint;
|
|
573
|
+
}
|
|
574
|
+
/**
|
|
575
|
+
* Check if a display object now has graphics content that warrants an instruction.
|
|
576
|
+
*/
|
|
577
|
+
_hasGraphicsContent(obj) {
|
|
578
|
+
const graphics = obj.graphics;
|
|
579
|
+
return graphics != null && graphics.commands.length > 0;
|
|
580
|
+
}
|
|
581
|
+
// ── Phase B: execute ──────────────────────────────────────────────────────
|
|
582
|
+
/**
|
|
583
|
+
* Walk `set` and dispatch each instruction to its render pipe. No
|
|
584
|
+
* scene-graph traversal happens here — `renderGroup` instructions recurse
|
|
585
|
+
* into their own nested `InstructionSet` via this same method.
|
|
586
|
+
*/
|
|
587
|
+
_executeInstructions(set, buffer) {
|
|
588
|
+
// Stack for offscreen buffers opened by filter/mask push instructions.
|
|
589
|
+
const offscreenStack = [];
|
|
590
|
+
const scissorStack = [];
|
|
591
|
+
// Track the currently active buffer — leaf instructions draw into this.
|
|
592
|
+
let activeBuffer = buffer;
|
|
593
|
+
for (let i = 0; i < set.instructionSize; i++) {
|
|
594
|
+
const inst = set.instructions[i];
|
|
595
|
+
switch (inst.renderPipeId) {
|
|
596
|
+
// ── Leaf nodes ────────────────────────────────────────────────
|
|
597
|
+
case 'bitmap':
|
|
598
|
+
case 'mesh':
|
|
599
|
+
case 'graphics':
|
|
600
|
+
case 'text':
|
|
601
|
+
case 'particle': {
|
|
602
|
+
const leaf = inst;
|
|
603
|
+
this._applyTransform(activeBuffer, leaf.transform);
|
|
604
|
+
this._executeLeafInstruction(leaf, activeBuffer);
|
|
605
|
+
break;
|
|
606
|
+
}
|
|
607
|
+
// ── DisplayList cache ─────────────────────────────────────────
|
|
608
|
+
case 'displayListCache': {
|
|
609
|
+
const cacheInst = inst;
|
|
610
|
+
this._applyTransform(activeBuffer, cacheInst.transform);
|
|
611
|
+
this._executeDisplayListCache(cacheInst.renderable, activeBuffer, cacheInst.offsetX, cacheInst.offsetY);
|
|
612
|
+
break;
|
|
613
|
+
}
|
|
614
|
+
// ── RenderGroup ───────────────────────────────────────────────
|
|
615
|
+
case 'renderGroup': {
|
|
616
|
+
const rgInst = inst;
|
|
617
|
+
this._applyTransform(activeBuffer, rgInst.transform);
|
|
618
|
+
this._executeInstructions(rgInst.set, activeBuffer);
|
|
619
|
+
break;
|
|
620
|
+
}
|
|
621
|
+
// ── Filter push/pop ───────────────────────────────────────────
|
|
622
|
+
case 'filterPush': {
|
|
623
|
+
const push = inst;
|
|
624
|
+
const pushT = push.transform;
|
|
625
|
+
this._applyTransform(activeBuffer, pushT);
|
|
626
|
+
const offscreen = this._filterPipe.executePush(push, activeBuffer);
|
|
627
|
+
offscreenStack.push(offscreen);
|
|
628
|
+
if (offscreen) {
|
|
629
|
+
this._configureOffscreenTransform(offscreen, push.renderable.$getOriginalBounds(), pushT);
|
|
630
|
+
activeBuffer = offscreen;
|
|
631
|
+
}
|
|
632
|
+
break;
|
|
633
|
+
}
|
|
634
|
+
case 'filterPop': {
|
|
635
|
+
const pop = inst;
|
|
636
|
+
const offscreen = offscreenStack.pop();
|
|
637
|
+
if (offscreen)
|
|
638
|
+
activeBuffer =
|
|
639
|
+
offscreenStack.length > 0 ? (offscreenStack[offscreenStack.length - 1] ?? buffer) : buffer;
|
|
640
|
+
this._applyTransform(activeBuffer, pop.push.transform);
|
|
641
|
+
this._filterPipe.executePop(pop, activeBuffer, offscreen);
|
|
642
|
+
break;
|
|
643
|
+
}
|
|
644
|
+
// ── Mask / clip push/pop ──────────────────────────────────────
|
|
645
|
+
case 'maskPush': {
|
|
646
|
+
const push = inst;
|
|
647
|
+
const pushT = push.transform;
|
|
648
|
+
this._applyTransform(activeBuffer, pushT);
|
|
649
|
+
if (push.isScrollRect) {
|
|
650
|
+
const usedScissor = this._maskPipe.executeScrollRectPush(push, activeBuffer);
|
|
651
|
+
scissorStack.push(usedScissor);
|
|
652
|
+
offscreenStack.push(undefined);
|
|
653
|
+
}
|
|
654
|
+
else {
|
|
655
|
+
const displayBuffer = this._maskPipe.executeClipPush(push, activeBuffer);
|
|
656
|
+
offscreenStack.push(displayBuffer);
|
|
657
|
+
if (displayBuffer) {
|
|
658
|
+
this._configureOffscreenTransform(displayBuffer, push.renderable.$getOriginalBounds(), pushT);
|
|
659
|
+
activeBuffer = displayBuffer;
|
|
660
|
+
}
|
|
661
|
+
}
|
|
662
|
+
break;
|
|
663
|
+
}
|
|
664
|
+
case 'maskPop': {
|
|
665
|
+
const pop = inst;
|
|
666
|
+
if (pop.push.isScrollRect) {
|
|
667
|
+
const usedScissor = scissorStack.pop() ?? false;
|
|
668
|
+
offscreenStack.pop();
|
|
669
|
+
this._maskPipe.executeScrollRectPop(activeBuffer, usedScissor);
|
|
670
|
+
}
|
|
671
|
+
else {
|
|
672
|
+
const displayBuffer = offscreenStack.pop();
|
|
673
|
+
// Restore the parent buffer before compositing.
|
|
674
|
+
if (displayBuffer)
|
|
675
|
+
activeBuffer =
|
|
676
|
+
offscreenStack.length > 0
|
|
677
|
+
? (offscreenStack[offscreenStack.length - 1] ?? buffer)
|
|
678
|
+
: buffer;
|
|
679
|
+
this._applyTransform(activeBuffer, pop.push.transform);
|
|
680
|
+
this._maskPipe.executeClipPop(pop, activeBuffer, displayBuffer);
|
|
681
|
+
}
|
|
682
|
+
break;
|
|
683
|
+
}
|
|
684
|
+
}
|
|
685
|
+
}
|
|
686
|
+
}
|
|
687
|
+
/**
|
|
688
|
+
* Execute one leaf instruction through its owning render pipe.
|
|
689
|
+
*/
|
|
690
|
+
_executeLeafInstruction(instruction, buffer) {
|
|
691
|
+
switch (instruction.renderPipeId) {
|
|
692
|
+
case 'bitmap':
|
|
693
|
+
this._bitmapPipe.execute(instruction, buffer);
|
|
694
|
+
break;
|
|
695
|
+
case 'mesh':
|
|
696
|
+
this._meshPipe.execute(instruction, buffer);
|
|
697
|
+
break;
|
|
698
|
+
case 'graphics':
|
|
699
|
+
this._graphicsPipe.execute(instruction, buffer);
|
|
700
|
+
break;
|
|
701
|
+
case 'text':
|
|
702
|
+
this._textPipe.execute(instruction, buffer);
|
|
703
|
+
break;
|
|
704
|
+
case 'particle':
|
|
705
|
+
this._particlePipe.execute(instruction, buffer);
|
|
706
|
+
break;
|
|
707
|
+
}
|
|
708
|
+
}
|
|
709
|
+
/**
|
|
710
|
+
* Restore `buffer`'s global matrix/alpha/tint from a snapshot, adjusting
|
|
711
|
+
* for the buffer's offscreen origin if it's a filter/mask offscreen target.
|
|
712
|
+
*/
|
|
713
|
+
_applyTransform(buffer, t) {
|
|
714
|
+
const m = buffer.globalMatrix;
|
|
715
|
+
const tx = t.tx + t.a * t.offsetX + t.c * t.offsetY;
|
|
716
|
+
const ty = t.ty + t.b * t.offsetX + t.d * t.offsetY;
|
|
717
|
+
if (buffer.hasOffscreenTransform) {
|
|
718
|
+
const inverse = buffer.offscreenInverseTransform;
|
|
719
|
+
m.a = inverse.a * t.a + inverse.c * t.b;
|
|
720
|
+
m.b = inverse.b * t.a + inverse.d * t.b;
|
|
721
|
+
m.c = inverse.a * t.c + inverse.c * t.d;
|
|
722
|
+
m.d = inverse.b * t.c + inverse.d * t.d;
|
|
723
|
+
m.tx = inverse.a * tx + inverse.c * ty + inverse.tx + buffer.offscreenLocalX;
|
|
724
|
+
m.ty = inverse.b * tx + inverse.d * ty + inverse.ty + buffer.offscreenLocalY;
|
|
725
|
+
buffer.globalAlpha = t.alpha;
|
|
726
|
+
buffer.globalTintColor = t.tint;
|
|
727
|
+
return;
|
|
728
|
+
}
|
|
729
|
+
m.a = t.a;
|
|
730
|
+
m.b = t.b;
|
|
731
|
+
m.c = t.c;
|
|
732
|
+
m.d = t.d;
|
|
733
|
+
m.tx = tx - buffer.offscreenOriginX;
|
|
734
|
+
m.ty = ty - buffer.offscreenOriginY;
|
|
735
|
+
buffer.globalAlpha = t.alpha;
|
|
736
|
+
buffer.globalTintColor = t.tint;
|
|
737
|
+
}
|
|
738
|
+
/**
|
|
739
|
+
* Configure conversion from world-space instruction snapshots into the
|
|
740
|
+
* effect owner's local offscreen coordinate system. Filter padding shifts
|
|
741
|
+
* the content bounds origin from (0,0) to (padX,padY).
|
|
742
|
+
*/
|
|
743
|
+
_configureOffscreenTransform(buf, bounds, t) {
|
|
744
|
+
const padX = buf.filterPadX;
|
|
745
|
+
const padY = buf.filterPadY;
|
|
746
|
+
const det = t.a * t.d - t.b * t.c;
|
|
747
|
+
if (Math.abs(det) <= 1e-12) {
|
|
748
|
+
const tx = t.tx + t.a * t.offsetX + t.c * t.offsetY;
|
|
749
|
+
const ty = t.ty + t.b * t.offsetX + t.d * t.offsetY;
|
|
750
|
+
const worldBX = t.a * bounds.x + t.c * bounds.y + tx;
|
|
751
|
+
const worldBY = t.b * bounds.x + t.d * bounds.y + ty;
|
|
752
|
+
buf.offscreenOriginX = worldBX - padX;
|
|
753
|
+
buf.offscreenOriginY = worldBY - padY;
|
|
754
|
+
buf.hasOffscreenTransform = false;
|
|
755
|
+
return;
|
|
756
|
+
}
|
|
757
|
+
const inverse = buf.offscreenInverseTransform;
|
|
758
|
+
inverse.a = t.d / det;
|
|
759
|
+
inverse.b = -t.b / det;
|
|
760
|
+
inverse.c = -t.c / det;
|
|
761
|
+
inverse.d = t.a / det;
|
|
762
|
+
const tx = t.tx + t.a * t.offsetX + t.c * t.offsetY;
|
|
763
|
+
const ty = t.ty + t.b * t.offsetX + t.d * t.offsetY;
|
|
764
|
+
inverse.tx = (t.c * ty - t.d * tx) / det;
|
|
765
|
+
inverse.ty = (t.b * tx - t.a * ty) / det;
|
|
766
|
+
buf.offscreenLocalX = padX - bounds.x;
|
|
767
|
+
buf.offscreenLocalY = padY - bounds.y;
|
|
768
|
+
buf.hasOffscreenTransform = true;
|
|
769
|
+
}
|
|
770
|
+
/**
|
|
771
|
+
* Execute a `displayListCache` instruction: refresh the cached bitmap if
|
|
772
|
+
* dirty (re-rendering `obj`'s subtree via the canvas renderer into an
|
|
773
|
+
* offscreen surface), then draw that cached bitmap into `buffer`.
|
|
774
|
+
*/
|
|
775
|
+
_executeDisplayListCache(obj, buffer, offsetX, offsetY) {
|
|
776
|
+
const $displayList = obj.$displayList;
|
|
777
|
+
if (!$displayList)
|
|
778
|
+
return;
|
|
779
|
+
if (obj.$cacheDirty || obj.$renderDirty) {
|
|
780
|
+
if ($displayList.updateSurfaceSize(buffer.context.maxTextureSize)) {
|
|
781
|
+
$displayList.renderBuffer.clear();
|
|
782
|
+
const resolution = $displayList.actualResolution;
|
|
783
|
+
$displayList.renderBuffer.context.setTransform(resolution, 0, 0, resolution, 0, 0);
|
|
784
|
+
this._canvasRenderer.renderToContext(obj, $displayList.renderBuffer.context, $displayList.offsetX, $displayList.offsetY);
|
|
785
|
+
$displayList.updateBitmapData();
|
|
786
|
+
// The DisplayList keeps the same BitmapData and canvas identity
|
|
787
|
+
// between cache refreshes. getWebGLTexture() therefore reuses the
|
|
788
|
+
// existing GPU texture, but an offscreen canvas does not upload its
|
|
789
|
+
// changed pixels automatically. Refresh it explicitly so resized or
|
|
790
|
+
// re-rendered cache content is sampled at its current dimensions.
|
|
791
|
+
const bitmapData = $displayList.bitmapData;
|
|
792
|
+
if (bitmapData?.webGLTexture && bitmapData.source) {
|
|
793
|
+
buffer.context.updateTexture(bitmapData.webGLTexture, bitmapData.source);
|
|
794
|
+
}
|
|
795
|
+
}
|
|
796
|
+
obj.$cacheDirty = false;
|
|
797
|
+
obj.$renderDirty = false;
|
|
798
|
+
// Structure may have changed inside the cached subtree — mark dirty
|
|
799
|
+
// so next frame rebuilds if the cache is invalidated.
|
|
800
|
+
}
|
|
801
|
+
if (!$displayList.bitmapData?.source)
|
|
802
|
+
return;
|
|
803
|
+
const bd = $displayList.bitmapData;
|
|
804
|
+
const w = $displayList.renderBuffer.width;
|
|
805
|
+
const h = $displayList.renderBuffer.height;
|
|
806
|
+
const resolution = $displayList.actualResolution;
|
|
807
|
+
// offsetX/Y already in globalMatrix via _applyTransform.
|
|
808
|
+
if (offsetX !== 0 || offsetY !== 0) {
|
|
809
|
+
buffer.globalMatrix.append(1, 0, 0, 1, offsetX, offsetY);
|
|
810
|
+
}
|
|
811
|
+
buffer.context.drawImage(bd, 0, 0, w, h, -$displayList.offsetX, -$displayList.offsetY, w / resolution, h / resolution, w, h, false, $displayList.scaleMode === 'linear');
|
|
812
|
+
if (offsetX !== 0 || offsetY !== 0) {
|
|
813
|
+
buffer.globalMatrix.append(1, 0, 0, 1, -offsetX, -offsetY);
|
|
814
|
+
}
|
|
815
|
+
}
|
|
816
|
+
/**
|
|
817
|
+
* Build and execute a mask object through the regular instruction pipeline.
|
|
818
|
+
* Scratch sets are separated by nesting depth because a mask subtree may
|
|
819
|
+
* contain another mask and re-enter this method during execution.
|
|
820
|
+
*/
|
|
821
|
+
_renderMaskObject(obj, buffer, offsetX, offsetY) {
|
|
822
|
+
const depth = this._maskInstructionDepth++;
|
|
823
|
+
let set = this._maskInstructionSets[depth];
|
|
824
|
+
if (!set) {
|
|
825
|
+
set = new InstructionSet();
|
|
826
|
+
this._maskInstructionSets[depth] = set;
|
|
827
|
+
}
|
|
828
|
+
try {
|
|
829
|
+
set.reset();
|
|
830
|
+
buffer.globalAlpha = 1;
|
|
831
|
+
buffer.globalTintColor = 0xffffff;
|
|
832
|
+
// RenderGroups are intentionally inlined into this scratch set. Their
|
|
833
|
+
// persistent sets contain transforms from the main scene coordinate space.
|
|
834
|
+
this._buildInstructions(obj, set, buffer, offsetX, offsetY, MASK_BUILD_OPTIONS);
|
|
835
|
+
this._executeInstructions(set, buffer);
|
|
836
|
+
}
|
|
837
|
+
finally {
|
|
838
|
+
this._releaseInstructions(set);
|
|
839
|
+
set.reset();
|
|
840
|
+
this._maskInstructionDepth--;
|
|
841
|
+
}
|
|
842
|
+
}
|
|
843
|
+
// ── Structure dirty notification ──────────────────────────────────────────
|
|
844
|
+
/**
|
|
845
|
+
* Call this when the scene graph structure changes (child added/removed,
|
|
846
|
+
* visibility toggled, filter added, etc.) to trigger a full rebuild next frame.
|
|
847
|
+
*
|
|
848
|
+
* If `owner` is provided and is a RenderGroup, only that group's set is
|
|
849
|
+
* marked dirty — the parent set is left untouched.
|
|
850
|
+
*/
|
|
851
|
+
markStructureDirty(owner) {
|
|
852
|
+
if (owner?.isRenderGroup) {
|
|
853
|
+
const groupSet = this._renderGroupSets.get(owner);
|
|
854
|
+
if (groupSet) {
|
|
855
|
+
groupSet.structureDirty = true;
|
|
856
|
+
return;
|
|
857
|
+
}
|
|
858
|
+
}
|
|
859
|
+
this._instructionSet.structureDirty = true;
|
|
860
|
+
// When no specific owner is given (e.g. context restored), mark ALL
|
|
861
|
+
// RenderGroup sets dirty so they also rebuild with fresh texture refs.
|
|
862
|
+
if (!owner) {
|
|
863
|
+
for (let i = this._renderGroupSetList.length - 1; i >= 0; i--) {
|
|
864
|
+
const container = this._renderGroupSetList[i].deref();
|
|
865
|
+
if (!container) {
|
|
866
|
+
// GC'd — remove dead entry.
|
|
867
|
+
this._renderGroupSetList.splice(i, 1);
|
|
868
|
+
continue;
|
|
869
|
+
}
|
|
870
|
+
const groupSet = this._renderGroupSets.get(container);
|
|
871
|
+
if (groupSet)
|
|
872
|
+
groupSet.structureDirty = true;
|
|
873
|
+
}
|
|
874
|
+
}
|
|
875
|
+
}
|
|
876
|
+
/**
|
|
877
|
+
* @internal Called by Player when a DisplayObject's data changes but the
|
|
878
|
+
* scene structure is stable. Queues the object for a transform-snapshot
|
|
879
|
+
* update instead of a full rebuild.
|
|
880
|
+
*
|
|
881
|
+
* Routes to the RenderGroup's set if the object lives inside one.
|
|
882
|
+
*/
|
|
883
|
+
markRenderableDirty(obj) {
|
|
884
|
+
if (obj instanceof DisplayObjectContainer && obj.isRenderGroup) {
|
|
885
|
+
const groupSet = this._renderGroupSets.get(obj);
|
|
886
|
+
if (groupSet && !groupSet.structureDirty)
|
|
887
|
+
groupSet.markRenderableDirty(obj);
|
|
888
|
+
this._findOwningSet(obj.$parent).markRenderableDirty(obj);
|
|
889
|
+
return;
|
|
890
|
+
}
|
|
891
|
+
// Walk up to find the nearest RenderGroup ancestor (if any).
|
|
892
|
+
let p = obj.$parent;
|
|
893
|
+
while (p) {
|
|
894
|
+
if (p instanceof DisplayObjectContainer && p.isRenderGroup) {
|
|
895
|
+
const groupSet = this._renderGroupSets.get(p);
|
|
896
|
+
if (groupSet) {
|
|
897
|
+
if (!groupSet.structureDirty)
|
|
898
|
+
groupSet.markRenderableDirty(obj);
|
|
899
|
+
return;
|
|
900
|
+
}
|
|
901
|
+
}
|
|
902
|
+
p = p.$parent;
|
|
903
|
+
}
|
|
904
|
+
// No RenderGroup ancestor — route to the root set.
|
|
905
|
+
if (!this._instructionSet.structureDirty)
|
|
906
|
+
this._instructionSet.markRenderableDirty(obj);
|
|
907
|
+
}
|
|
908
|
+
_findOwningSet(parent) {
|
|
909
|
+
let current = parent;
|
|
910
|
+
while (current) {
|
|
911
|
+
if (current.isRenderGroup) {
|
|
912
|
+
const groupSet = this._renderGroupSets.get(current);
|
|
913
|
+
if (groupSet)
|
|
914
|
+
return groupSet;
|
|
915
|
+
}
|
|
916
|
+
current = current.$parent;
|
|
917
|
+
}
|
|
918
|
+
return this._instructionSet;
|
|
919
|
+
}
|
|
920
|
+
}
|
|
921
|
+
//# sourceMappingURL=WebGLRenderer.js.map
|