@next2d/player 1.14.19 → 1.14.21
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/index.js +3 -3
- package/package.json +31 -6
- package/interface/AjaxEventImpl.d.ts +0 -5
- package/interface/AjaxEventImpl.js +0 -1
- package/interface/AjaxOptionImpl.d.ts +0 -13
- package/interface/AjaxOptionImpl.js +0 -1
- package/interface/AttachmentImpl.d.ts +0 -11
- package/interface/AttachmentImpl.js +0 -1
- package/interface/BitmapDataChannelImpl.d.ts +0 -1
- package/interface/BitmapDataChannelImpl.js +0 -1
- package/interface/BitmapDrawObjectImpl.d.ts +0 -6
- package/interface/BitmapDrawObjectImpl.js +0 -1
- package/interface/BitmapFilterTypeImpl.d.ts +0 -1
- package/interface/BitmapFilterTypeImpl.js +0 -1
- package/interface/BlendModeImpl.d.ts +0 -1
- package/interface/BlendModeImpl.js +0 -1
- package/interface/BoundsImpl.d.ts +0 -6
- package/interface/BoundsImpl.js +0 -1
- package/interface/Character.d.ts +0 -2
- package/interface/Character.js +0 -1
- package/interface/CharacterImpl.d.ts +0 -2
- package/interface/CharacterImpl.js +0 -1
- package/interface/ClipObjectImpl.d.ts +0 -14
- package/interface/ClipObjectImpl.js +0 -1
- package/interface/ColorStopImpl.d.ts +0 -7
- package/interface/ColorStopImpl.js +0 -1
- package/interface/DictionaryTagImpl.d.ts +0 -7
- package/interface/DictionaryTagImpl.js +0 -1
- package/interface/DisplacementMapFilterModeImpl.d.ts +0 -1
- package/interface/DisplacementMapFilterModeImpl.js +0 -1
- package/interface/DisplayImpl.d.ts +0 -28
- package/interface/DisplayImpl.js +0 -1
- package/interface/DisplayObjectImpl.d.ts +0 -2
- package/interface/DisplayObjectImpl.js +0 -1
- package/interface/DragRulesImpl.d.ts +0 -7
- package/interface/DragRulesImpl.js +0 -1
- package/interface/DropTargetImpl.d.ts +0 -2
- package/interface/DropTargetImpl.js +0 -1
- package/interface/EventDispatcherImpl.d.ts +0 -2
- package/interface/EventDispatcherImpl.js +0 -1
- package/interface/EventListenerImpl.d.ts +0 -6
- package/interface/EventListenerImpl.js +0 -1
- package/interface/EventsImpl.d.ts +0 -20
- package/interface/EventsImpl.js +0 -1
- package/interface/FillMeshImpl.d.ts +0 -5
- package/interface/FillMeshImpl.js +0 -1
- package/interface/FilterArrayImpl.d.ts +0 -10
- package/interface/FilterArrayImpl.js +0 -1
- package/interface/FilterQualityImpl.d.ts +0 -1
- package/interface/FilterQualityImpl.js +0 -1
- package/interface/FiltersImpl.d.ts +0 -20
- package/interface/FiltersImpl.js +0 -1
- package/interface/GeomImpl.d.ts +0 -12
- package/interface/GeomImpl.js +0 -1
- package/interface/GradientTypeImpl.d.ts +0 -3
- package/interface/GradientTypeImpl.js +0 -1
- package/interface/GraphicsParentImpl.d.ts +0 -2
- package/interface/GraphicsParentImpl.js +0 -1
- package/interface/GridImpl.d.ts +0 -6
- package/interface/GridImpl.js +0 -1
- package/interface/ImageTypeImpl.d.ts +0 -1
- package/interface/ImageTypeImpl.js +0 -1
- package/interface/IndexRangeImpl.d.ts +0 -4
- package/interface/IndexRangeImpl.js +0 -1
- package/interface/LoaderInfoDataImpl.d.ts +0 -7
- package/interface/LoaderInfoDataImpl.js +0 -1
- package/interface/LoopConfigImpl.d.ts +0 -8
- package/interface/LoopConfigImpl.js +0 -1
- package/interface/LoopTypeImpl.d.ts +0 -1
- package/interface/LoopTypeImpl.js +0 -1
- package/interface/MediaImpl.d.ts +0 -10
- package/interface/MediaImpl.js +0 -1
- package/interface/MovieClipActionObjectImpl.d.ts +0 -5
- package/interface/MovieClipActionObjectImpl.js +0 -1
- package/interface/MovieClipCharacterImpl.d.ts +0 -18
- package/interface/MovieClipCharacterImpl.js +0 -1
- package/interface/MovieClipLabelObjectImpl.d.ts +0 -4
- package/interface/MovieClipLabelObjectImpl.js +0 -1
- package/interface/MovieClipSoundObjectImpl.d.ts +0 -5
- package/interface/MovieClipSoundObjectImpl.js +0 -1
- package/interface/NetImpl.d.ts +0 -6
- package/interface/NetImpl.js +0 -1
- package/interface/NoCodeDataImpl.d.ts +0 -7
- package/interface/NoCodeDataImpl.js +0 -1
- package/interface/NoCodeDataZlibImpl.d.ts +0 -4
- package/interface/NoCodeDataZlibImpl.js +0 -1
- package/interface/ParentImpl.d.ts +0 -2
- package/interface/ParentImpl.js +0 -1
- package/interface/PlaceObjectImpl.d.ts +0 -12
- package/interface/PlaceObjectImpl.js +0 -1
- package/interface/PlayerHitObjectImpl.d.ts +0 -7
- package/interface/PlayerHitObjectImpl.js +0 -1
- package/interface/PlayerModeImpl.d.ts +0 -1
- package/interface/PlayerModeImpl.js +0 -1
- package/interface/PlayerOptionsImpl.d.ts +0 -8
- package/interface/PlayerOptionsImpl.js +0 -1
- package/interface/PointImpl.d.ts +0 -4
- package/interface/PointImpl.js +0 -1
- package/interface/PreObjectImpl.d.ts +0 -23
- package/interface/PreObjectImpl.js +0 -1
- package/interface/PropertyBitmapDataMessageImpl.d.ts +0 -8
- package/interface/PropertyBitmapDataMessageImpl.js +0 -1
- package/interface/PropertyContainerMessageImpl.d.ts +0 -6
- package/interface/PropertyContainerMessageImpl.js +0 -1
- package/interface/PropertyMessageImpl.d.ts +0 -41
- package/interface/PropertyMessageImpl.js +0 -1
- package/interface/PropertyMessageMapImpl.d.ts +0 -2
- package/interface/PropertyMessageMapImpl.js +0 -1
- package/interface/PropertyShapeMessageImpl.d.ts +0 -6
- package/interface/PropertyShapeMessageImpl.js +0 -1
- package/interface/PropertyTextMessageImpl.d.ts +0 -25
- package/interface/PropertyTextMessageImpl.js +0 -1
- package/interface/PropertyVideoMessageImpl.d.ts +0 -5
- package/interface/PropertyVideoMessageImpl.js +0 -1
- package/interface/RGBAImpl.d.ts +0 -6
- package/interface/RGBAImpl.js +0 -1
- package/interface/ShapeCharacterImpl.d.ts +0 -14
- package/interface/ShapeCharacterImpl.js +0 -1
- package/interface/SoundCharacterImpl.d.ts +0 -5
- package/interface/SoundCharacterImpl.js +0 -1
- package/interface/SoundTagImpl.d.ts +0 -6
- package/interface/SoundTagImpl.js +0 -1
- package/interface/SpriteImpl.d.ts +0 -2
- package/interface/SpriteImpl.js +0 -1
- package/interface/StageDataImpl.d.ts +0 -6
- package/interface/StageDataImpl.js +0 -1
- package/interface/StageQualityImpl.d.ts +0 -1
- package/interface/StageQualityImpl.js +0 -1
- package/interface/StrokeMethImpl.d.ts +0 -4
- package/interface/StrokeMethImpl.js +0 -1
- package/interface/StrokeTypeImpl.d.ts +0 -2
- package/interface/StrokeTypeImpl.js +0 -1
- package/interface/SurfaceFilterImpl.d.ts +0 -6
- package/interface/SurfaceFilterImpl.js +0 -1
- package/interface/TextBreakObjectImpl.d.ts +0 -9
- package/interface/TextBreakObjectImpl.js +0 -1
- package/interface/TextCharacterImpl.d.ts +0 -27
- package/interface/TextCharacterImpl.js +0 -1
- package/interface/TextDataImpl.d.ts +0 -2
- package/interface/TextDataImpl.js +0 -1
- package/interface/TextFieldAutoSizeImpl.d.ts +0 -1
- package/interface/TextFieldAutoSizeImpl.js +0 -1
- package/interface/TextFieldTypeImpl.d.ts +0 -1
- package/interface/TextFieldTypeImpl.js +0 -1
- package/interface/TextFormatAlignImpl.d.ts +0 -1
- package/interface/TextFormatAlignImpl.js +0 -1
- package/interface/TextFormatVerticalAlignImpl.d.ts +0 -1
- package/interface/TextFormatVerticalAlignImpl.js +0 -1
- package/interface/TextImageObjectImpl.d.ts +0 -11
- package/interface/TextImageObjectImpl.js +0 -1
- package/interface/TextImpl.d.ts +0 -6
- package/interface/TextImpl.js +0 -1
- package/interface/TextObjectImpl.d.ts +0 -7
- package/interface/TextObjectImpl.js +0 -1
- package/interface/TextObjectModeImpl.d.ts +0 -1
- package/interface/TextObjectModeImpl.js +0 -1
- package/interface/TextStringObjectImpl.d.ts +0 -7
- package/interface/TextStringObjectImpl.js +0 -1
- package/interface/UIImpl.d.ts +0 -8
- package/interface/UIImpl.js +0 -1
- package/interface/URLLoaderDataFormatImpl.d.ts +0 -1
- package/interface/URLLoaderDataFormatImpl.js +0 -1
- package/interface/URLRequestMethodImpl.d.ts +0 -1
- package/interface/URLRequestMethodImpl.js +0 -1
- package/interface/UniformDataImpl.d.ts +0 -5
- package/interface/UniformDataImpl.js +0 -1
- package/interface/UnzipQueueImpl.d.ts +0 -6
- package/interface/UnzipQueueImpl.js +0 -1
- package/interface/VerticesImpl.d.ts +0 -1
- package/interface/VerticesImpl.js +0 -1
- package/interface/VideoCharacterImpl.d.ts +0 -12
- package/interface/VideoCharacterImpl.js +0 -1
- package/next2d/display/BitmapData.d.ts +0 -143
- package/next2d/display/BitmapData.js +0 -387
- package/next2d/display/BlendMode.d.ts +0 -204
- package/next2d/display/BlendMode.js +0 -240
- package/next2d/display/DisplayObject.d.ts +0 -565
- package/next2d/display/DisplayObject.js +0 -1670
- package/next2d/display/DisplayObjectContainer.d.ts +0 -351
- package/next2d/display/DisplayObjectContainer.js +0 -1776
- package/next2d/display/FrameLabel.d.ts +0 -98
- package/next2d/display/FrameLabel.js +0 -120
- package/next2d/display/Graphics.d.ts +0 -577
- package/next2d/display/Graphics.js +0 -2161
- package/next2d/display/GraphicsBitmapFill.d.ts +0 -49
- package/next2d/display/GraphicsBitmapFill.js +0 -86
- package/next2d/display/GraphicsGradientFill.d.ts +0 -66
- package/next2d/display/GraphicsGradientFill.js +0 -157
- package/next2d/display/InteractiveObject.d.ts +0 -32
- package/next2d/display/InteractiveObject.js +0 -43
- package/next2d/display/Loader.d.ts +0 -131
- package/next2d/display/Loader.js +0 -321
- package/next2d/display/LoaderInfo.d.ts +0 -122
- package/next2d/display/LoaderInfo.js +0 -184
- package/next2d/display/LoopConfig.d.ts +0 -108
- package/next2d/display/LoopConfig.js +0 -156
- package/next2d/display/LoopType.d.ts +0 -104
- package/next2d/display/LoopType.js +0 -122
- package/next2d/display/MovieClip.d.ts +0 -314
- package/next2d/display/MovieClip.js +0 -941
- package/next2d/display/Shape.d.ts +0 -169
- package/next2d/display/Shape.js +0 -509
- package/next2d/display/Sprite.d.ts +0 -175
- package/next2d/display/Sprite.js +0 -280
- package/next2d/display/Stage.d.ts +0 -164
- package/next2d/display/Stage.js +0 -251
- package/next2d/events/Event.d.ts +0 -424
- package/next2d/events/Event.js +0 -560
- package/next2d/events/EventDispatcher.d.ts +0 -138
- package/next2d/events/EventDispatcher.js +0 -623
- package/next2d/events/EventPhase.d.ts +0 -80
- package/next2d/events/EventPhase.js +0 -94
- package/next2d/events/FocusEvent.d.ts +0 -89
- package/next2d/events/FocusEvent.js +0 -103
- package/next2d/events/HTTPStatusEvent.d.ts +0 -107
- package/next2d/events/HTTPStatusEvent.js +0 -139
- package/next2d/events/IOErrorEvent.d.ts +0 -82
- package/next2d/events/IOErrorEvent.js +0 -101
- package/next2d/events/MouseEvent.d.ts +0 -163
- package/next2d/events/MouseEvent.js +0 -207
- package/next2d/events/ProgressEvent.d.ts +0 -97
- package/next2d/events/ProgressEvent.js +0 -123
- package/next2d/events/VideoEvent.d.ts +0 -145
- package/next2d/events/VideoEvent.js +0 -181
- package/next2d/filters/BevelFilter.d.ts +0 -254
- package/next2d/filters/BevelFilter.js +0 -491
- package/next2d/filters/BitmapFilter.d.ts +0 -75
- package/next2d/filters/BitmapFilter.js +0 -95
- package/next2d/filters/BlurFilter.d.ts +0 -150
- package/next2d/filters/BlurFilter.js +0 -370
- package/next2d/filters/ColorMatrixFilter.d.ts +0 -116
- package/next2d/filters/ColorMatrixFilter.js +0 -179
- package/next2d/filters/ConvolutionFilter.d.ts +0 -210
- package/next2d/filters/ConvolutionFilter.js +0 -366
- package/next2d/filters/DisplacementMapFilter.d.ts +0 -212
- package/next2d/filters/DisplacementMapFilter.js +0 -372
- package/next2d/filters/DropShadowFilter.d.ts +0 -240
- package/next2d/filters/DropShadowFilter.js +0 -461
- package/next2d/filters/GlowFilter.d.ts +0 -204
- package/next2d/filters/GlowFilter.js +0 -356
- package/next2d/filters/GradientBevelFilter.d.ts +0 -243
- package/next2d/filters/GradientBevelFilter.js +0 -474
- package/next2d/filters/GradientGlowFilter.d.ts +0 -243
- package/next2d/filters/GradientGlowFilter.js +0 -464
- package/next2d/geom/ColorTransform.d.ts +0 -201
- package/next2d/geom/ColorTransform.js +0 -278
- package/next2d/geom/Matrix.d.ts +0 -299
- package/next2d/geom/Matrix.js +0 -454
- package/next2d/geom/Point.d.ts +0 -213
- package/next2d/geom/Point.js +0 -274
- package/next2d/geom/Rectangle.d.ts +0 -364
- package/next2d/geom/Rectangle.js +0 -513
- package/next2d/geom/Transform.d.ts +0 -213
- package/next2d/geom/Transform.js +0 -492
- package/next2d/media/Sound.d.ts +0 -208
- package/next2d/media/Sound.js +0 -504
- package/next2d/media/SoundMixer.d.ts +0 -68
- package/next2d/media/SoundMixer.js +0 -115
- package/next2d/media/SoundTransform.d.ts +0 -80
- package/next2d/media/SoundTransform.js +0 -111
- package/next2d/media/Video.d.ts +0 -331
- package/next2d/media/Video.js +0 -856
- package/next2d/net/URLRequest.d.ts +0 -143
- package/next2d/net/URLRequest.js +0 -232
- package/next2d/net/URLRequestHeader.d.ts +0 -82
- package/next2d/net/URLRequestHeader.js +0 -105
- package/next2d/text/TextField.d.ts +0 -644
- package/next2d/text/TextField.js +0 -2662
- package/next2d/text/TextFormat.d.ts +0 -250
- package/next2d/text/TextFormat.js +0 -460
- package/next2d/ui/Easing.d.ts +0 -359
- package/next2d/ui/Easing.js +0 -481
- package/next2d/ui/Job.d.ts +0 -155
- package/next2d/ui/Job.js +0 -333
- package/next2d/ui/Tween.d.ts +0 -62
- package/next2d/ui/Tween.js +0 -72
- package/packages/Display.d.ts +0 -3
- package/packages/Display.js +0 -36
- package/packages/Events.d.ts +0 -3
- package/packages/Events.js +0 -28
- package/packages/Filters.d.ts +0 -3
- package/packages/Filters.js +0 -28
- package/packages/Geom.d.ts +0 -3
- package/packages/Geom.js +0 -20
- package/packages/Media.d.ts +0 -3
- package/packages/Media.js +0 -18
- package/packages/Net.d.ts +0 -3
- package/packages/Net.js +0 -14
- package/packages/Text.d.ts +0 -3
- package/packages/Text.js +0 -14
- package/packages/UI.d.ts +0 -3
- package/packages/UI.js +0 -16
- package/player/Next2D.d.ts +0 -70
- package/player/Next2D.js +0 -192
- package/player/Player.d.ts +0 -334
- package/player/Player.js +0 -1863
- package/util/CacheStore.d.ts +0 -115
- package/util/CacheStore.js +0 -276
- package/util/Global.d.ts +0 -23
- package/util/Global.js +0 -67
- package/util/RenderUtil.d.ts +0 -472
- package/util/RenderUtil.js +0 -686
- package/util/Shortcut.d.ts +0 -28
- package/util/Shortcut.js +0 -28
- package/util/Util.d.ts +0 -334
- package/util/Util.js +0 -844
- package/webgl/BezierConverter.d.ts +0 -59
- package/webgl/BezierConverter.js +0 -106
- package/webgl/CanvasGradientToWebGL.d.ts +0 -94
- package/webgl/CanvasGradientToWebGL.js +0 -181
- package/webgl/CanvasPatternToWebGL.d.ts +0 -39
- package/webgl/CanvasPatternToWebGL.js +0 -66
- package/webgl/CanvasToWebGLContext.d.ts +0 -596
- package/webgl/CanvasToWebGLContext.js +0 -1421
- package/webgl/CanvasToWebGLContextBlend.d.ts +0 -97
- package/webgl/CanvasToWebGLContextBlend.js +0 -299
- package/webgl/CanvasToWebGLContextGrid.d.ts +0 -74
- package/webgl/CanvasToWebGLContextGrid.js +0 -283
- package/webgl/CanvasToWebGLContextMask.d.ts +0 -113
- package/webgl/CanvasToWebGLContextMask.js +0 -436
- package/webgl/CanvasToWebGLContextPath.d.ts +0 -111
- package/webgl/CanvasToWebGLContextPath.js +0 -210
- package/webgl/CanvasToWebGLContextStyle.d.ts +0 -77
- package/webgl/CanvasToWebGLContextStyle.js +0 -139
- package/webgl/ColorBufferPool.d.ts +0 -58
- package/webgl/ColorBufferPool.js +0 -134
- package/webgl/FrameBufferManager.d.ts +0 -135
- package/webgl/FrameBufferManager.js +0 -358
- package/webgl/StencilBufferPool.d.ts +0 -56
- package/webgl/StencilBufferPool.js +0 -142
- package/webgl/TextureManager.d.ts +0 -130
- package/webgl/TextureManager.js +0 -296
- package/webgl/VertexArrayObjectManager.d.ts +0 -95
- package/webgl/VertexArrayObjectManager.js +0 -277
- package/webgl/WebGLFillMeshGenerator.d.ts +0 -31
- package/webgl/WebGLFillMeshGenerator.js +0 -101
- package/webgl/WebGLStrokeMeshGenerator.d.ts +0 -182
- package/webgl/WebGLStrokeMeshGenerator.js +0 -504
- package/webgl/shader/CanvasToWebGLShader.d.ts +0 -85
- package/webgl/shader/CanvasToWebGLShader.js +0 -192
- package/webgl/shader/CanvasToWebGLShaderList.d.ts +0 -70
- package/webgl/shader/CanvasToWebGLShaderList.js +0 -109
- package/webgl/shader/GradientLUTGenerator.d.ts +0 -36
- package/webgl/shader/GradientLUTGenerator.js +0 -123
- package/webgl/shader/WebGLShaderUniform.d.ts +0 -52
- package/webgl/shader/WebGLShaderUniform.js +0 -165
- package/webgl/shader/fragment/FragmentShaderLibrary.d.ts +0 -18
- package/webgl/shader/fragment/FragmentShaderLibrary.js +0 -35
- package/webgl/shader/fragment/FragmentShaderSource.d.ts +0 -29
- package/webgl/shader/fragment/FragmentShaderSource.js +0 -99
- package/webgl/shader/fragment/FragmentShaderSourceBlend.d.ts +0 -67
- package/webgl/shader/fragment/FragmentShaderSourceBlend.js +0 -319
- package/webgl/shader/fragment/FragmentShaderSourceGradient.d.ts +0 -44
- package/webgl/shader/fragment/FragmentShaderSourceGradient.js +0 -114
- package/webgl/shader/fragment/FragmentShaderSourceGradientLUT.d.ts +0 -14
- package/webgl/shader/fragment/FragmentShaderSourceGradientLUT.js +0 -58
- package/webgl/shader/fragment/FragmentShaderSourceTexture.d.ts +0 -12
- package/webgl/shader/fragment/FragmentShaderSourceTexture.js +0 -36
- package/webgl/shader/fragment/filter/FragmentShaderSourceBlurFilter.d.ts +0 -12
- package/webgl/shader/fragment/filter/FragmentShaderSourceBlurFilter.js +0 -42
- package/webgl/shader/fragment/filter/FragmentShaderSourceColorMatrixFilter.d.ts +0 -11
- package/webgl/shader/fragment/filter/FragmentShaderSourceColorMatrixFilter.js +0 -35
- package/webgl/shader/fragment/filter/FragmentShaderSourceConvolutionFilter.d.ts +0 -16
- package/webgl/shader/fragment/filter/FragmentShaderSourceConvolutionFilter.js +0 -80
- package/webgl/shader/fragment/filter/FragmentShaderSourceDisplacementMapFilter.d.ts +0 -15
- package/webgl/shader/fragment/filter/FragmentShaderSourceDisplacementMapFilter.js +0 -106
- package/webgl/shader/fragment/filter/FragmentShaderSourceFilter.d.ts +0 -112
- package/webgl/shader/fragment/filter/FragmentShaderSourceFilter.js +0 -275
- package/webgl/shader/variants/BlendShaderVariantCollection.d.ts +0 -99
- package/webgl/shader/variants/BlendShaderVariantCollection.js +0 -239
- package/webgl/shader/variants/FilterShaderVariantCollection.d.ts +0 -150
- package/webgl/shader/variants/FilterShaderVariantCollection.js +0 -395
- package/webgl/shader/variants/GradientLUTShaderVariantCollection.d.ts +0 -49
- package/webgl/shader/variants/GradientLUTShaderVariantCollection.js +0 -107
- package/webgl/shader/variants/GradientShapeShaderVariantCollection.d.ts +0 -61
- package/webgl/shader/variants/GradientShapeShaderVariantCollection.js +0 -196
- package/webgl/shader/variants/ShapeShaderVariantCollection.d.ts +0 -117
- package/webgl/shader/variants/ShapeShaderVariantCollection.js +0 -427
- package/webgl/shader/vertex/VertexShaderLibrary.d.ts +0 -18
- package/webgl/shader/vertex/VertexShaderLibrary.js +0 -75
- package/webgl/shader/vertex/VertexShaderSource.d.ts +0 -23
- package/webgl/shader/vertex/VertexShaderSource.js +0 -92
- package/webgl/shader/vertex/VertexShaderSourceFill.d.ts +0 -45
- package/webgl/shader/vertex/VertexShaderSourceFill.js +0 -112
- package/webgl/shader/vertex/VertexShaderSourceStroke.d.ts +0 -27
- package/webgl/shader/vertex/VertexShaderSourceStroke.js +0 -149
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
import { TextureManager } from "./TextureManager";
|
|
2
|
-
import type { AttachmentImpl } from "../interface/AttachmentImpl";
|
|
3
|
-
/**
|
|
4
|
-
* @class
|
|
5
|
-
*/
|
|
6
|
-
export declare class FrameBufferManager {
|
|
7
|
-
private _$gl;
|
|
8
|
-
private _$objectPool;
|
|
9
|
-
private readonly _$frameBuffer;
|
|
10
|
-
private readonly _$frameBufferTexture;
|
|
11
|
-
private _$currentAttachment;
|
|
12
|
-
private _$isBinding;
|
|
13
|
-
private readonly _$textureManager;
|
|
14
|
-
private readonly _$stencilBufferPool;
|
|
15
|
-
private readonly _$colorBufferPool;
|
|
16
|
-
/**
|
|
17
|
-
* @param {WebGL2RenderingContext} gl
|
|
18
|
-
* @param {number} samples
|
|
19
|
-
* @constructor
|
|
20
|
-
*/
|
|
21
|
-
constructor(gl: WebGL2RenderingContext, samples: number);
|
|
22
|
-
/**
|
|
23
|
-
* @member {AttachmentImpl|null}
|
|
24
|
-
* @readonly
|
|
25
|
-
* @public
|
|
26
|
-
*/
|
|
27
|
-
get currentAttachment(): AttachmentImpl | null;
|
|
28
|
-
/**
|
|
29
|
-
* @member {TextureManager}
|
|
30
|
-
* @readonly
|
|
31
|
-
* @public
|
|
32
|
-
*/
|
|
33
|
-
get textureManager(): TextureManager;
|
|
34
|
-
/**
|
|
35
|
-
* @param {number} width
|
|
36
|
-
* @param {number} height
|
|
37
|
-
* @param {boolean} [multisample=false]
|
|
38
|
-
* @param {number} [samples=0]
|
|
39
|
-
* @return {AttachmentImpl}
|
|
40
|
-
* @method
|
|
41
|
-
* @public
|
|
42
|
-
*/
|
|
43
|
-
createCacheAttachment(width: number, height: number, multisample?: boolean, samples?: number): AttachmentImpl;
|
|
44
|
-
/**
|
|
45
|
-
* @param {number} width
|
|
46
|
-
* @param {number} height
|
|
47
|
-
* @return {void}
|
|
48
|
-
* @method
|
|
49
|
-
* @public
|
|
50
|
-
*/
|
|
51
|
-
setMaxSize(width: number, height: number): void;
|
|
52
|
-
/**
|
|
53
|
-
* @param {number} width
|
|
54
|
-
* @param {number} height
|
|
55
|
-
* @return {AttachmentImpl}
|
|
56
|
-
* @method
|
|
57
|
-
* @public
|
|
58
|
-
*/
|
|
59
|
-
createTextureAttachment(width: number, height: number): AttachmentImpl;
|
|
60
|
-
/**
|
|
61
|
-
* @param {WebGLTexture} texture
|
|
62
|
-
* @return {AttachmentImpl}
|
|
63
|
-
* @method
|
|
64
|
-
* @public
|
|
65
|
-
*/
|
|
66
|
-
createTextureAttachmentFrom(texture: WebGLTexture): AttachmentImpl;
|
|
67
|
-
/**
|
|
68
|
-
* @param {AttachmentImpl} [attachment = null]
|
|
69
|
-
* @param {boolean} [should_release_texture=false]
|
|
70
|
-
* @return {void}
|
|
71
|
-
* @method
|
|
72
|
-
* @public
|
|
73
|
-
*/
|
|
74
|
-
releaseAttachment(attachment?: AttachmentImpl | null, should_release_texture?: boolean): void;
|
|
75
|
-
/**
|
|
76
|
-
* @param {object} attachment
|
|
77
|
-
* @return {void}
|
|
78
|
-
* @method
|
|
79
|
-
* @public
|
|
80
|
-
*/
|
|
81
|
-
bind(attachment: AttachmentImpl): void;
|
|
82
|
-
/**
|
|
83
|
-
* @return void
|
|
84
|
-
* @method
|
|
85
|
-
* @public
|
|
86
|
-
*/
|
|
87
|
-
unbind(): void;
|
|
88
|
-
/**
|
|
89
|
-
* @return {WebGLTexture}
|
|
90
|
-
* @method
|
|
91
|
-
* @public
|
|
92
|
-
*/
|
|
93
|
-
getTextureFromCurrentAttachment(): WebGLTexture;
|
|
94
|
-
/**
|
|
95
|
-
* @param {number} width
|
|
96
|
-
* @param {number} height
|
|
97
|
-
* @param {Uint8Array} [pixels=null]
|
|
98
|
-
* @param {boolean} [premultipliedAlpha=false]
|
|
99
|
-
* @param {boolean} [flip_y=true]
|
|
100
|
-
* @return {WebGLTexture}
|
|
101
|
-
* @public
|
|
102
|
-
*/
|
|
103
|
-
createTextureFromPixels(width: number, height: number, pixels?: Uint8Array | null, premultipliedAlpha?: boolean, flip_y?: boolean): WebGLTexture;
|
|
104
|
-
/**
|
|
105
|
-
* @param {HTMLCanvasElement} canvas
|
|
106
|
-
* @return {WebGLTexture}
|
|
107
|
-
* @public
|
|
108
|
-
*/
|
|
109
|
-
createTextureFromCanvas(canvas: HTMLCanvasElement | OffscreenCanvas): WebGLTexture;
|
|
110
|
-
/**
|
|
111
|
-
* @param {HTMLImageElement} image
|
|
112
|
-
* @param {boolean} [smoothing=false]
|
|
113
|
-
* @return {WebGLTexture}
|
|
114
|
-
* @public
|
|
115
|
-
*/
|
|
116
|
-
createTextureFromImage(image: HTMLImageElement, smoothing?: boolean): WebGLTexture;
|
|
117
|
-
/**
|
|
118
|
-
* @param {HTMLVideoElement} video
|
|
119
|
-
* @param {boolean} [smoothing=false]
|
|
120
|
-
* @return {WebGLTexture}
|
|
121
|
-
* @public
|
|
122
|
-
*/
|
|
123
|
-
createTextureFromVideo(video: HTMLVideoElement, smoothing?: boolean): WebGLTexture;
|
|
124
|
-
/**
|
|
125
|
-
* @return {WebGLTexture}
|
|
126
|
-
* @public
|
|
127
|
-
*/
|
|
128
|
-
createTextureFromCurrentAttachment(): WebGLTexture;
|
|
129
|
-
/**
|
|
130
|
-
* @param {WebGLTexture} texture
|
|
131
|
-
* @return void
|
|
132
|
-
* @public
|
|
133
|
-
*/
|
|
134
|
-
releaseTexture(texture: WebGLTexture): void;
|
|
135
|
-
}
|
|
@@ -1,358 +0,0 @@
|
|
|
1
|
-
import { TextureManager } from "./TextureManager";
|
|
2
|
-
import { StencilBufferPool } from "./StencilBufferPool";
|
|
3
|
-
import { ColorBufferPool } from "./ColorBufferPool";
|
|
4
|
-
/**
|
|
5
|
-
* @class
|
|
6
|
-
*/
|
|
7
|
-
export class FrameBufferManager {
|
|
8
|
-
/**
|
|
9
|
-
* @param {WebGL2RenderingContext} gl
|
|
10
|
-
* @param {number} samples
|
|
11
|
-
* @constructor
|
|
12
|
-
*/
|
|
13
|
-
constructor(gl, samples) {
|
|
14
|
-
/**
|
|
15
|
-
* @type {WebGL2RenderingContext}
|
|
16
|
-
* @private
|
|
17
|
-
*/
|
|
18
|
-
this._$gl = gl;
|
|
19
|
-
/**
|
|
20
|
-
* @type {array}
|
|
21
|
-
* @private
|
|
22
|
-
*/
|
|
23
|
-
this._$objectPool = [];
|
|
24
|
-
/**
|
|
25
|
-
* @type {WebGLFramebuffer}
|
|
26
|
-
* @private
|
|
27
|
-
*/
|
|
28
|
-
this._$frameBuffer = gl.createFramebuffer();
|
|
29
|
-
gl.bindFramebuffer(gl.READ_FRAMEBUFFER, this._$frameBuffer);
|
|
30
|
-
/**
|
|
31
|
-
* @type {WebGLFramebuffer}
|
|
32
|
-
* @private
|
|
33
|
-
*/
|
|
34
|
-
this._$frameBufferTexture = gl.createFramebuffer();
|
|
35
|
-
/**
|
|
36
|
-
* @type {AttachmentImpl}
|
|
37
|
-
* @default null
|
|
38
|
-
* @private
|
|
39
|
-
*/
|
|
40
|
-
this._$currentAttachment = null;
|
|
41
|
-
/**
|
|
42
|
-
* @type {boolean}
|
|
43
|
-
* @default false
|
|
44
|
-
* @private
|
|
45
|
-
*/
|
|
46
|
-
this._$isBinding = false;
|
|
47
|
-
/**
|
|
48
|
-
* @type {TextureManager}
|
|
49
|
-
* @private
|
|
50
|
-
*/
|
|
51
|
-
this._$textureManager = new TextureManager(gl);
|
|
52
|
-
/**
|
|
53
|
-
* @type {StencilBufferPool}
|
|
54
|
-
* @private
|
|
55
|
-
*/
|
|
56
|
-
this._$stencilBufferPool = new StencilBufferPool(gl);
|
|
57
|
-
/**
|
|
58
|
-
* @type {ColorBufferPool}
|
|
59
|
-
* @private
|
|
60
|
-
*/
|
|
61
|
-
this._$colorBufferPool = new ColorBufferPool(gl, samples);
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* @member {AttachmentImpl|null}
|
|
65
|
-
* @readonly
|
|
66
|
-
* @public
|
|
67
|
-
*/
|
|
68
|
-
get currentAttachment() {
|
|
69
|
-
return this._$currentAttachment;
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* @member {TextureManager}
|
|
73
|
-
* @readonly
|
|
74
|
-
* @public
|
|
75
|
-
*/
|
|
76
|
-
get textureManager() {
|
|
77
|
-
return this._$textureManager;
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* @param {number} width
|
|
81
|
-
* @param {number} height
|
|
82
|
-
* @param {boolean} [multisample=false]
|
|
83
|
-
* @param {number} [samples=0]
|
|
84
|
-
* @return {AttachmentImpl}
|
|
85
|
-
* @method
|
|
86
|
-
* @public
|
|
87
|
-
*/
|
|
88
|
-
createCacheAttachment(width, height, multisample = false, samples = 0) {
|
|
89
|
-
const attachment = this._$objectPool.pop() || {
|
|
90
|
-
"width": 0,
|
|
91
|
-
"height": 0,
|
|
92
|
-
"color": null,
|
|
93
|
-
"texture": null,
|
|
94
|
-
"msaa": false,
|
|
95
|
-
"stencil": null,
|
|
96
|
-
"mask": false,
|
|
97
|
-
"clipLevel": 0,
|
|
98
|
-
"isActive": false
|
|
99
|
-
};
|
|
100
|
-
const texture = this._$textureManager.create(width, height);
|
|
101
|
-
attachment.width = width;
|
|
102
|
-
attachment.height = height;
|
|
103
|
-
if (multisample) {
|
|
104
|
-
attachment.color = this._$colorBufferPool.create(width, height, samples);
|
|
105
|
-
attachment.texture = texture;
|
|
106
|
-
attachment.msaa = true;
|
|
107
|
-
attachment.stencil = attachment.color.stencil;
|
|
108
|
-
}
|
|
109
|
-
else {
|
|
110
|
-
attachment.color = texture;
|
|
111
|
-
attachment.texture = texture;
|
|
112
|
-
attachment.msaa = false;
|
|
113
|
-
attachment.stencil = this._$stencilBufferPool.create(width, height);
|
|
114
|
-
}
|
|
115
|
-
attachment.mask = false;
|
|
116
|
-
attachment.clipLevel = 0;
|
|
117
|
-
attachment.isActive = true;
|
|
118
|
-
return attachment;
|
|
119
|
-
}
|
|
120
|
-
/**
|
|
121
|
-
* @param {number} width
|
|
122
|
-
* @param {number} height
|
|
123
|
-
* @return {void}
|
|
124
|
-
* @method
|
|
125
|
-
* @public
|
|
126
|
-
*/
|
|
127
|
-
setMaxSize(width, height) {
|
|
128
|
-
this._$stencilBufferPool._$maxWidth = width;
|
|
129
|
-
this._$stencilBufferPool._$maxHeight = height;
|
|
130
|
-
this._$textureManager._$maxWidth = width;
|
|
131
|
-
this._$textureManager._$maxHeight = height;
|
|
132
|
-
}
|
|
133
|
-
/**
|
|
134
|
-
* @param {number} width
|
|
135
|
-
* @param {number} height
|
|
136
|
-
* @return {AttachmentImpl}
|
|
137
|
-
* @method
|
|
138
|
-
* @public
|
|
139
|
-
*/
|
|
140
|
-
createTextureAttachment(width, height) {
|
|
141
|
-
const attachment = this._$objectPool.pop() || {
|
|
142
|
-
"width": 0,
|
|
143
|
-
"height": 0,
|
|
144
|
-
"color": null,
|
|
145
|
-
"texture": null,
|
|
146
|
-
"msaa": false,
|
|
147
|
-
"stencil": null,
|
|
148
|
-
"mask": false,
|
|
149
|
-
"clipLevel": 0,
|
|
150
|
-
"isActive": false
|
|
151
|
-
};
|
|
152
|
-
const texture = this._$textureManager.create(width, height);
|
|
153
|
-
attachment.width = width;
|
|
154
|
-
attachment.height = height;
|
|
155
|
-
attachment.color = texture;
|
|
156
|
-
attachment.texture = texture;
|
|
157
|
-
attachment.msaa = false;
|
|
158
|
-
attachment.stencil = null;
|
|
159
|
-
attachment.mask = false;
|
|
160
|
-
attachment.clipLevel = 0;
|
|
161
|
-
attachment.isActive = true;
|
|
162
|
-
return attachment;
|
|
163
|
-
}
|
|
164
|
-
/**
|
|
165
|
-
* @param {WebGLTexture} texture
|
|
166
|
-
* @return {AttachmentImpl}
|
|
167
|
-
* @method
|
|
168
|
-
* @public
|
|
169
|
-
*/
|
|
170
|
-
createTextureAttachmentFrom(texture) {
|
|
171
|
-
const attachment = this._$objectPool.pop() || {
|
|
172
|
-
"width": 0,
|
|
173
|
-
"height": 0,
|
|
174
|
-
"color": null,
|
|
175
|
-
"texture": null,
|
|
176
|
-
"msaa": false,
|
|
177
|
-
"stencil": null,
|
|
178
|
-
"mask": false,
|
|
179
|
-
"clipLevel": 0,
|
|
180
|
-
"isActive": true
|
|
181
|
-
};
|
|
182
|
-
attachment.width = texture.width;
|
|
183
|
-
attachment.height = texture.height;
|
|
184
|
-
attachment.color = texture;
|
|
185
|
-
attachment.texture = texture;
|
|
186
|
-
attachment.msaa = false;
|
|
187
|
-
attachment.stencil = null;
|
|
188
|
-
attachment.mask = false;
|
|
189
|
-
attachment.clipLevel = 0;
|
|
190
|
-
attachment.isActive = true;
|
|
191
|
-
return attachment;
|
|
192
|
-
}
|
|
193
|
-
/**
|
|
194
|
-
* @param {AttachmentImpl} [attachment = null]
|
|
195
|
-
* @param {boolean} [should_release_texture=false]
|
|
196
|
-
* @return {void}
|
|
197
|
-
* @method
|
|
198
|
-
* @public
|
|
199
|
-
*/
|
|
200
|
-
releaseAttachment(attachment = null, should_release_texture = false) {
|
|
201
|
-
if (!attachment || !attachment.isActive) {
|
|
202
|
-
return;
|
|
203
|
-
}
|
|
204
|
-
if (attachment.msaa) {
|
|
205
|
-
if (attachment.color instanceof WebGLRenderbuffer) {
|
|
206
|
-
this._$colorBufferPool.release(attachment.color);
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
else if (attachment.stencil) {
|
|
210
|
-
this._$stencilBufferPool.release(attachment.stencil);
|
|
211
|
-
}
|
|
212
|
-
if (should_release_texture && attachment.texture) {
|
|
213
|
-
this._$textureManager.release(attachment.texture);
|
|
214
|
-
}
|
|
215
|
-
attachment.color = null;
|
|
216
|
-
attachment.texture = null;
|
|
217
|
-
attachment.stencil = null;
|
|
218
|
-
attachment.isActive = false;
|
|
219
|
-
this._$objectPool.push(attachment);
|
|
220
|
-
}
|
|
221
|
-
/**
|
|
222
|
-
* @param {object} attachment
|
|
223
|
-
* @return {void}
|
|
224
|
-
* @method
|
|
225
|
-
* @public
|
|
226
|
-
*/
|
|
227
|
-
bind(attachment) {
|
|
228
|
-
this._$currentAttachment = attachment;
|
|
229
|
-
if (!this._$isBinding) {
|
|
230
|
-
this._$isBinding = true;
|
|
231
|
-
this._$gl.bindFramebuffer(this._$gl.FRAMEBUFFER, this._$frameBuffer);
|
|
232
|
-
}
|
|
233
|
-
if (attachment.msaa) {
|
|
234
|
-
if (attachment.color instanceof WebGLRenderbuffer) {
|
|
235
|
-
this._$gl.bindRenderbuffer(this._$gl.RENDERBUFFER, attachment.color);
|
|
236
|
-
this._$gl.framebufferRenderbuffer(this._$gl.FRAMEBUFFER, this._$gl.COLOR_ATTACHMENT0, this._$gl.RENDERBUFFER, attachment.color);
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
else {
|
|
240
|
-
if (attachment.color instanceof WebGLTexture) {
|
|
241
|
-
if (attachment.color) {
|
|
242
|
-
this._$textureManager.bind0(attachment.color);
|
|
243
|
-
}
|
|
244
|
-
this._$gl.framebufferTexture2D(this._$gl.FRAMEBUFFER, this._$gl.COLOR_ATTACHMENT0, this._$gl.TEXTURE_2D, attachment.color, 0);
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
this._$gl.bindRenderbuffer(this._$gl.RENDERBUFFER, attachment.stencil);
|
|
248
|
-
this._$gl.framebufferRenderbuffer(this._$gl.FRAMEBUFFER, this._$gl.STENCIL_ATTACHMENT, this._$gl.RENDERBUFFER, attachment.stencil);
|
|
249
|
-
}
|
|
250
|
-
/**
|
|
251
|
-
* @return void
|
|
252
|
-
* @method
|
|
253
|
-
* @public
|
|
254
|
-
*/
|
|
255
|
-
unbind() {
|
|
256
|
-
this._$currentAttachment = null;
|
|
257
|
-
if (this._$isBinding) {
|
|
258
|
-
this._$isBinding = false;
|
|
259
|
-
this._$gl.bindFramebuffer(this._$gl.FRAMEBUFFER, null);
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
/**
|
|
263
|
-
* @return {WebGLTexture}
|
|
264
|
-
* @method
|
|
265
|
-
* @public
|
|
266
|
-
*/
|
|
267
|
-
getTextureFromCurrentAttachment() {
|
|
268
|
-
if (!this._$currentAttachment) {
|
|
269
|
-
throw new Error("the current attachment is null.");
|
|
270
|
-
}
|
|
271
|
-
if (!this._$currentAttachment.msaa
|
|
272
|
-
&& this._$currentAttachment.texture) {
|
|
273
|
-
return this._$currentAttachment.texture;
|
|
274
|
-
}
|
|
275
|
-
const width = this._$currentAttachment.width;
|
|
276
|
-
const height = this._$currentAttachment.height;
|
|
277
|
-
const texture = this._$currentAttachment.texture;
|
|
278
|
-
if (!texture) {
|
|
279
|
-
throw new Error("the texture is null.");
|
|
280
|
-
}
|
|
281
|
-
texture.dirty = false;
|
|
282
|
-
this._$gl.bindFramebuffer(this._$gl.DRAW_FRAMEBUFFER, this._$frameBufferTexture);
|
|
283
|
-
this._$textureManager.bind0(texture);
|
|
284
|
-
this._$gl.framebufferTexture2D(this._$gl.FRAMEBUFFER, this._$gl.COLOR_ATTACHMENT0, this._$gl.TEXTURE_2D, texture, 0);
|
|
285
|
-
this._$gl.blitFramebuffer(0, 0, width, height, 0, 0, width, height, this._$gl.COLOR_BUFFER_BIT, this._$gl.NEAREST);
|
|
286
|
-
this._$gl.bindFramebuffer(this._$gl.FRAMEBUFFER, this._$frameBuffer);
|
|
287
|
-
return texture;
|
|
288
|
-
}
|
|
289
|
-
/**
|
|
290
|
-
* @param {number} width
|
|
291
|
-
* @param {number} height
|
|
292
|
-
* @param {Uint8Array} [pixels=null]
|
|
293
|
-
* @param {boolean} [premultipliedAlpha=false]
|
|
294
|
-
* @param {boolean} [flip_y=true]
|
|
295
|
-
* @return {WebGLTexture}
|
|
296
|
-
* @public
|
|
297
|
-
*/
|
|
298
|
-
createTextureFromPixels(width, height, pixels = null, premultipliedAlpha = false, flip_y = true) {
|
|
299
|
-
return this
|
|
300
|
-
._$textureManager
|
|
301
|
-
.create(width, height, pixels, premultipliedAlpha, flip_y);
|
|
302
|
-
}
|
|
303
|
-
/**
|
|
304
|
-
* @param {HTMLCanvasElement} canvas
|
|
305
|
-
* @return {WebGLTexture}
|
|
306
|
-
* @public
|
|
307
|
-
*/
|
|
308
|
-
createTextureFromCanvas(canvas) {
|
|
309
|
-
return this
|
|
310
|
-
._$textureManager
|
|
311
|
-
.createFromCanvas(canvas);
|
|
312
|
-
}
|
|
313
|
-
/**
|
|
314
|
-
* @param {HTMLImageElement} image
|
|
315
|
-
* @param {boolean} [smoothing=false]
|
|
316
|
-
* @return {WebGLTexture}
|
|
317
|
-
* @public
|
|
318
|
-
*/
|
|
319
|
-
createTextureFromImage(image, smoothing = false) {
|
|
320
|
-
return this
|
|
321
|
-
._$textureManager
|
|
322
|
-
.createFromImage(image, smoothing);
|
|
323
|
-
}
|
|
324
|
-
/**
|
|
325
|
-
* @param {HTMLVideoElement} video
|
|
326
|
-
* @param {boolean} [smoothing=false]
|
|
327
|
-
* @return {WebGLTexture}
|
|
328
|
-
* @public
|
|
329
|
-
*/
|
|
330
|
-
createTextureFromVideo(video, smoothing = false) {
|
|
331
|
-
return this
|
|
332
|
-
._$textureManager
|
|
333
|
-
.createFromVideo(video, smoothing);
|
|
334
|
-
}
|
|
335
|
-
/**
|
|
336
|
-
* @return {WebGLTexture}
|
|
337
|
-
* @public
|
|
338
|
-
*/
|
|
339
|
-
createTextureFromCurrentAttachment() {
|
|
340
|
-
if (!this._$currentAttachment) {
|
|
341
|
-
throw new Error("the current attachment is null.");
|
|
342
|
-
}
|
|
343
|
-
const width = this._$currentAttachment.width;
|
|
344
|
-
const height = this._$currentAttachment.height;
|
|
345
|
-
const texture = this._$textureManager.create(width, height);
|
|
346
|
-
this._$textureManager.bind0(texture);
|
|
347
|
-
this._$gl.copyTexSubImage2D(this._$gl.TEXTURE_2D, 0, 0, 0, 0, 0, width, height);
|
|
348
|
-
return texture;
|
|
349
|
-
}
|
|
350
|
-
/**
|
|
351
|
-
* @param {WebGLTexture} texture
|
|
352
|
-
* @return void
|
|
353
|
-
* @public
|
|
354
|
-
*/
|
|
355
|
-
releaseTexture(texture) {
|
|
356
|
-
this._$textureManager.release(texture);
|
|
357
|
-
}
|
|
358
|
-
}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @class
|
|
3
|
-
*/
|
|
4
|
-
export declare class StencilBufferPool {
|
|
5
|
-
private readonly _$gl;
|
|
6
|
-
private readonly _$objectPool;
|
|
7
|
-
private _$objectPoolArea;
|
|
8
|
-
_$maxWidth: number;
|
|
9
|
-
_$maxHeight: number;
|
|
10
|
-
/**
|
|
11
|
-
* @param {WebGL2RenderingContext} gl
|
|
12
|
-
* @constructor
|
|
13
|
-
*/
|
|
14
|
-
constructor(gl: WebGL2RenderingContext);
|
|
15
|
-
/**
|
|
16
|
-
* @member {number}
|
|
17
|
-
* @param {number} max_width
|
|
18
|
-
* @public
|
|
19
|
-
*/
|
|
20
|
-
set maxWidth(max_width: number);
|
|
21
|
-
/**
|
|
22
|
-
* @member {number}
|
|
23
|
-
* @param {number} max_height
|
|
24
|
-
* @public
|
|
25
|
-
*/
|
|
26
|
-
set maxHeight(max_height: number);
|
|
27
|
-
/**
|
|
28
|
-
* @return {WebGLRenderbuffer}
|
|
29
|
-
* @method
|
|
30
|
-
* @private
|
|
31
|
-
*/
|
|
32
|
-
_$createStencilBuffer(): WebGLRenderbuffer;
|
|
33
|
-
/**
|
|
34
|
-
* @param {number} width
|
|
35
|
-
* @param {number} height
|
|
36
|
-
* @return {WebGLRenderbuffer}
|
|
37
|
-
* @method
|
|
38
|
-
* @private
|
|
39
|
-
*/
|
|
40
|
-
_$getStencilBuffer(width: number, height: number): WebGLRenderbuffer;
|
|
41
|
-
/**
|
|
42
|
-
* @param {number} width
|
|
43
|
-
* @param {number} height
|
|
44
|
-
* @return {WebGLRenderbuffer}
|
|
45
|
-
* @method
|
|
46
|
-
* @public
|
|
47
|
-
*/
|
|
48
|
-
create(width: number, height: number): WebGLRenderbuffer;
|
|
49
|
-
/**
|
|
50
|
-
* @param {WebGLRenderbuffer} stencilBuffer
|
|
51
|
-
* @return {void}
|
|
52
|
-
* @method
|
|
53
|
-
* @public
|
|
54
|
-
*/
|
|
55
|
-
release(stencilBuffer: WebGLRenderbuffer): void;
|
|
56
|
-
}
|
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
import { $getArray } from "../util/RenderUtil";
|
|
2
|
-
/**
|
|
3
|
-
* @class
|
|
4
|
-
*/
|
|
5
|
-
export class StencilBufferPool {
|
|
6
|
-
/**
|
|
7
|
-
* @param {WebGL2RenderingContext} gl
|
|
8
|
-
* @constructor
|
|
9
|
-
*/
|
|
10
|
-
constructor(gl) {
|
|
11
|
-
/**
|
|
12
|
-
* @type {WebGL2RenderingContext}
|
|
13
|
-
* @private
|
|
14
|
-
*/
|
|
15
|
-
this._$gl = gl;
|
|
16
|
-
/**
|
|
17
|
-
* @type {array}
|
|
18
|
-
* @private
|
|
19
|
-
*/
|
|
20
|
-
this._$objectPool = $getArray();
|
|
21
|
-
/**
|
|
22
|
-
* @type {number}
|
|
23
|
-
* @default 0
|
|
24
|
-
* @private
|
|
25
|
-
*/
|
|
26
|
-
this._$objectPoolArea = 0;
|
|
27
|
-
/**
|
|
28
|
-
* @type {number}
|
|
29
|
-
* @default 0
|
|
30
|
-
* @private
|
|
31
|
-
*/
|
|
32
|
-
this._$maxWidth = 0;
|
|
33
|
-
/**
|
|
34
|
-
* @type {number}
|
|
35
|
-
* @default 0
|
|
36
|
-
* @private
|
|
37
|
-
*/
|
|
38
|
-
this._$maxHeight = 0;
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* @member {number}
|
|
42
|
-
* @param {number} max_width
|
|
43
|
-
* @public
|
|
44
|
-
*/
|
|
45
|
-
set maxWidth(max_width) {
|
|
46
|
-
this._$maxWidth = max_width;
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* @member {number}
|
|
50
|
-
* @param {number} max_height
|
|
51
|
-
* @public
|
|
52
|
-
*/
|
|
53
|
-
set maxHeight(max_height) {
|
|
54
|
-
this._$maxHeight = max_height;
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* @return {WebGLRenderbuffer}
|
|
58
|
-
* @method
|
|
59
|
-
* @private
|
|
60
|
-
*/
|
|
61
|
-
_$createStencilBuffer() {
|
|
62
|
-
const stencilBuffer = this._$gl.createRenderbuffer();
|
|
63
|
-
if (!stencilBuffer) {
|
|
64
|
-
throw new Error("the stencil buffer is null.");
|
|
65
|
-
}
|
|
66
|
-
stencilBuffer.width = 0;
|
|
67
|
-
stencilBuffer.height = 0;
|
|
68
|
-
stencilBuffer.area = 0;
|
|
69
|
-
stencilBuffer.dirty = true;
|
|
70
|
-
return stencilBuffer;
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* @param {number} width
|
|
74
|
-
* @param {number} height
|
|
75
|
-
* @return {WebGLRenderbuffer}
|
|
76
|
-
* @method
|
|
77
|
-
* @private
|
|
78
|
-
*/
|
|
79
|
-
_$getStencilBuffer(width, height) {
|
|
80
|
-
const length = this._$objectPool.length;
|
|
81
|
-
for (let idx = 0; idx < length; ++idx) {
|
|
82
|
-
const stencilBuffer = this._$objectPool[idx];
|
|
83
|
-
if (stencilBuffer.width === width
|
|
84
|
-
&& stencilBuffer.height === height) {
|
|
85
|
-
this._$objectPool.splice(idx, 1);
|
|
86
|
-
this._$objectPoolArea -= stencilBuffer.area;
|
|
87
|
-
return stencilBuffer;
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
if (length > 100) {
|
|
91
|
-
const stencilBuffer = this._$objectPool.shift();
|
|
92
|
-
if (stencilBuffer) {
|
|
93
|
-
this._$objectPoolArea -= stencilBuffer.area;
|
|
94
|
-
return stencilBuffer;
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
return this._$createStencilBuffer();
|
|
98
|
-
}
|
|
99
|
-
/**
|
|
100
|
-
* @param {number} width
|
|
101
|
-
* @param {number} height
|
|
102
|
-
* @return {WebGLRenderbuffer}
|
|
103
|
-
* @method
|
|
104
|
-
* @public
|
|
105
|
-
*/
|
|
106
|
-
create(width, height) {
|
|
107
|
-
const stencilBuffer = this._$getStencilBuffer(width, height);
|
|
108
|
-
if (stencilBuffer.width !== width || stencilBuffer.height !== height) {
|
|
109
|
-
stencilBuffer.width = width;
|
|
110
|
-
stencilBuffer.height = height;
|
|
111
|
-
stencilBuffer.area = width * height;
|
|
112
|
-
stencilBuffer.dirty = false;
|
|
113
|
-
this._$gl.bindRenderbuffer(this._$gl.RENDERBUFFER, stencilBuffer);
|
|
114
|
-
this._$gl.renderbufferStorage(this._$gl.RENDERBUFFER, this._$gl.STENCIL_INDEX8, width, height);
|
|
115
|
-
}
|
|
116
|
-
return stencilBuffer;
|
|
117
|
-
}
|
|
118
|
-
/**
|
|
119
|
-
* @param {WebGLRenderbuffer} stencilBuffer
|
|
120
|
-
* @return {void}
|
|
121
|
-
* @method
|
|
122
|
-
* @public
|
|
123
|
-
*/
|
|
124
|
-
release(stencilBuffer) {
|
|
125
|
-
// ステンシルバッファのサイズが非常に大きい場合はプールしない
|
|
126
|
-
if (stencilBuffer.area > this._$maxWidth * this._$maxHeight * 2) {
|
|
127
|
-
this._$gl.deleteRenderbuffer(stencilBuffer);
|
|
128
|
-
return;
|
|
129
|
-
}
|
|
130
|
-
stencilBuffer.dirty = true;
|
|
131
|
-
this._$objectPool.push(stencilBuffer);
|
|
132
|
-
this._$objectPoolArea += stencilBuffer.area;
|
|
133
|
-
// プール容量が一定を超えたら、古いステンシルバッファから削除していく
|
|
134
|
-
if (this._$objectPoolArea > this._$maxWidth * this._$maxHeight * 10) {
|
|
135
|
-
const oldStencilBuffer = this._$objectPool.shift();
|
|
136
|
-
if (oldStencilBuffer) {
|
|
137
|
-
this._$objectPoolArea -= oldStencilBuffer.area;
|
|
138
|
-
this._$gl.deleteRenderbuffer(oldStencilBuffer);
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
}
|