@lightningjs/renderer 3.0.0-beta7 → 3.0.0-beta9
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/dist/exports/utils.d.ts +2 -1
- package/dist/exports/utils.js +2 -1
- package/dist/exports/utils.js.map +1 -1
- package/dist/src/core/CoreNode.d.ts +24 -49
- package/dist/src/core/CoreNode.js +257 -255
- package/dist/src/core/CoreNode.js.map +1 -1
- package/dist/src/core/CoreTextNode.d.ts +1 -1
- package/dist/src/core/CoreTextNode.js +14 -15
- package/dist/src/core/CoreTextNode.js.map +1 -1
- package/dist/src/core/CoreTextureManager.d.ts +4 -9
- package/dist/src/core/CoreTextureManager.js +41 -78
- package/dist/src/core/CoreTextureManager.js.map +1 -1
- package/dist/src/core/Stage.d.ts +12 -27
- package/dist/src/core/Stage.js +50 -37
- package/dist/src/core/Stage.js.map +1 -1
- package/dist/src/core/TextureMemoryManager.d.ts +10 -1
- package/dist/src/core/TextureMemoryManager.js +103 -50
- package/dist/src/core/TextureMemoryManager.js.map +1 -1
- package/dist/src/core/animations/CoreAnimation.js +5 -0
- package/dist/src/core/animations/CoreAnimation.js.map +1 -1
- package/dist/src/core/animations/CoreAnimationController.d.ts +1 -0
- package/dist/src/core/animations/CoreAnimationController.js +11 -4
- package/dist/src/core/animations/CoreAnimationController.js.map +1 -1
- package/dist/src/core/lib/WebGlContextWrapper.d.ts +19 -2
- package/dist/src/core/lib/WebGlContextWrapper.js +56 -25
- package/dist/src/core/lib/WebGlContextWrapper.js.map +1 -1
- package/dist/src/core/renderers/CoreRenderer.d.ts +1 -0
- package/dist/src/core/renderers/CoreRenderer.js.map +1 -1
- package/dist/src/core/renderers/CoreShaderNode.d.ts +1 -0
- package/dist/src/core/renderers/CoreShaderNode.js +9 -0
- package/dist/src/core/renderers/CoreShaderNode.js.map +1 -1
- package/dist/src/core/renderers/canvas/CanvasRenderer.d.ts +1 -0
- package/dist/src/core/renderers/canvas/CanvasRenderer.js +3 -0
- package/dist/src/core/renderers/canvas/CanvasRenderer.js.map +1 -1
- package/dist/src/core/renderers/canvas/CanvasShaderNode.js +1 -4
- package/dist/src/core/renderers/canvas/CanvasShaderNode.js.map +1 -1
- package/dist/src/core/renderers/webgl/WebGlCtxTexture.js +0 -3
- package/dist/src/core/renderers/webgl/WebGlCtxTexture.js.map +1 -1
- package/dist/src/core/renderers/webgl/WebGlRenderer.d.ts +1 -0
- package/dist/src/core/renderers/webgl/WebGlRenderer.js +56 -54
- package/dist/src/core/renderers/webgl/WebGlRenderer.js.map +1 -1
- package/dist/src/core/renderers/webgl/WebGlShaderNode.js +1 -4
- package/dist/src/core/renderers/webgl/WebGlShaderNode.js.map +1 -1
- package/dist/src/core/renderers/webgl/WebGlShaderProgram.d.ts +4 -2
- package/dist/src/core/renderers/webgl/WebGlShaderProgram.js +31 -13
- package/dist/src/core/renderers/webgl/WebGlShaderProgram.js.map +1 -1
- package/dist/src/core/shaders/canvas/LinearGradient.js +5 -3
- package/dist/src/core/shaders/canvas/LinearGradient.js.map +1 -1
- package/dist/src/core/shaders/canvas/RadialGradient.js +13 -11
- package/dist/src/core/shaders/canvas/RadialGradient.js.map +1 -1
- package/dist/src/core/shaders/canvas/RoundedWithBorder.js +7 -5
- package/dist/src/core/shaders/canvas/RoundedWithBorder.js.map +1 -1
- package/dist/src/core/shaders/canvas/RoundedWithBorderAndShadow.js +10 -8
- package/dist/src/core/shaders/canvas/RoundedWithBorderAndShadow.js.map +1 -1
- package/dist/src/core/shaders/canvas/RoundedWithShadow.js +7 -5
- package/dist/src/core/shaders/canvas/RoundedWithShadow.js.map +1 -1
- package/dist/src/core/shaders/templates/BorderTemplate.d.ts +1 -1
- package/dist/src/core/shaders/templates/BorderTemplate.js +1 -1
- package/dist/src/core/shaders/templates/BorderTemplate.js.map +1 -1
- package/dist/src/core/shaders/templates/HolePunchTemplate.js +1 -1
- package/dist/src/core/shaders/templates/HolePunchTemplate.js.map +1 -1
- package/dist/src/core/shaders/templates/RoundedTemplate.js +1 -1
- package/dist/src/core/shaders/templates/RoundedTemplate.js.map +1 -1
- package/dist/src/core/shaders/templates/RoundedWithBorderAndShadowTemplate.d.ts +1 -1
- package/dist/src/core/shaders/templates/RoundedWithBorderTemplate.d.ts +1 -1
- package/dist/src/core/shaders/templates/RoundedWithShadowTemplate.d.ts +1 -1
- package/dist/src/core/shaders/templates/ShadowTemplate.d.ts +1 -1
- package/dist/src/core/shaders/{templates/shaderUtils.d.ts → utils.d.ts} +1 -1
- package/dist/src/core/shaders/{templates/shaderUtils.js → utils.js} +2 -2
- package/dist/src/core/shaders/utils.js.map +1 -0
- package/dist/src/core/shaders/webgl/HolePunch.js +4 -3
- package/dist/src/core/shaders/webgl/HolePunch.js.map +1 -1
- package/dist/src/core/shaders/webgl/LinearGradient.js +5 -4
- package/dist/src/core/shaders/webgl/LinearGradient.js.map +1 -1
- package/dist/src/core/shaders/webgl/RadialGradient.js +6 -5
- package/dist/src/core/shaders/webgl/RadialGradient.js.map +1 -1
- package/dist/src/core/shaders/webgl/RoundedWithBorder.js +18 -7
- package/dist/src/core/shaders/webgl/RoundedWithBorder.js.map +1 -1
- package/dist/src/core/shaders/webgl/RoundedWithBorderAndShadow.js +30 -17
- package/dist/src/core/shaders/webgl/RoundedWithBorderAndShadow.js.map +1 -1
- package/dist/src/core/text-rendering/renderers/SdfTextRenderer/SdfTextRenderer.js +0 -50
- package/dist/src/core/text-rendering/renderers/SdfTextRenderer/SdfTextRenderer.js.map +1 -1
- package/dist/src/core/textures/ImageTexture.d.ts +1 -1
- package/dist/src/core/textures/ImageTexture.js +1 -1
- package/dist/src/core/textures/ImageTexture.js.map +1 -1
- package/dist/src/core/textures/Texture.d.ts +12 -0
- package/dist/src/core/textures/Texture.js +19 -0
- package/dist/src/core/textures/Texture.js.map +1 -1
- package/dist/src/core/utils.d.ts +1 -1
- package/dist/src/main-api/Inspector.d.ts +6 -1
- package/dist/src/main-api/Inspector.js +42 -4
- package/dist/src/main-api/Inspector.js.map +1 -1
- package/dist/src/main-api/Renderer.d.ts +62 -43
- package/dist/src/main-api/Renderer.js +119 -31
- package/dist/src/main-api/Renderer.js.map +1 -1
- package/dist/tsconfig.dist.tsbuildinfo +1 -1
- package/exports/utils.ts +7 -1
- package/package.json +1 -1
- package/src/core/CoreNode.ts +307 -313
- package/src/core/CoreTextNode.ts +23 -20
- package/src/core/CoreTextureManager.ts +40 -99
- package/src/core/Stage.ts +68 -65
- package/src/core/TextureMemoryManager.ts +135 -67
- package/src/core/animations/CoreAnimation.ts +7 -0
- package/src/core/animations/CoreAnimationController.ts +13 -4
- package/src/core/lib/WebGlContextWrapper.ts +69 -75
- package/src/core/renderers/CoreRenderer.ts +1 -0
- package/src/core/renderers/CoreShaderNode.ts +10 -0
- package/src/core/renderers/canvas/CanvasRenderer.ts +4 -0
- package/src/core/renderers/canvas/CanvasShaderNode.ts +1 -4
- package/src/core/renderers/webgl/WebGlCtxTexture.ts +0 -3
- package/src/core/renderers/webgl/WebGlRenderer.ts +64 -65
- package/src/core/renderers/webgl/WebGlShaderNode.ts +2 -4
- package/src/core/renderers/webgl/WebGlShaderProgram.ts +37 -14
- package/src/core/shaders/canvas/LinearGradient.ts +8 -6
- package/src/core/shaders/canvas/RadialGradient.ts +22 -36
- package/src/core/shaders/canvas/RoundedWithBorder.ts +10 -8
- package/src/core/shaders/canvas/RoundedWithBorderAndShadow.ts +14 -12
- package/src/core/shaders/canvas/RoundedWithShadow.ts +8 -7
- package/src/core/shaders/templates/BorderTemplate.ts +1 -1
- package/src/core/shaders/templates/HolePunchTemplate.ts +1 -1
- package/src/core/shaders/templates/RoundedTemplate.ts +1 -1
- package/src/core/shaders/templates/RoundedWithBorderAndShadowTemplate.ts +1 -1
- package/src/core/shaders/templates/RoundedWithBorderTemplate.ts +1 -1
- package/src/core/shaders/templates/RoundedWithShadowTemplate.ts +1 -1
- package/src/core/shaders/templates/ShadowTemplate.ts +1 -1
- package/src/core/shaders/{templates/shaderUtils.ts → utils.ts} +2 -3
- package/src/core/shaders/webgl/HolePunch.ts +4 -7
- package/src/core/shaders/webgl/LinearGradient.ts +5 -4
- package/src/core/shaders/webgl/RadialGradient.ts +7 -6
- package/src/core/shaders/webgl/RoundedWithBorder.ts +18 -7
- package/src/core/shaders/webgl/RoundedWithBorderAndShadow.ts +30 -21
- package/src/core/text-rendering/renderers/SdfTextRenderer/SdfTextRenderer.ts +2 -58
- package/src/core/textures/ImageTexture.ts +17 -16
- package/src/core/textures/Texture.ts +23 -0
- package/src/main-api/Inspector.ts +52 -5
- package/src/main-api/Renderer.ts +222 -77
- package/dist/src/core/platform.d.ts +0 -10
- package/dist/src/core/platform.js +0 -56
- package/dist/src/core/platform.js.map +0 -1
- package/dist/src/core/renderers/CoreShader.d.ts +0 -9
- package/dist/src/core/renderers/CoreShader.js +0 -28
- package/dist/src/core/renderers/CoreShader.js.map +0 -1
- package/dist/src/core/renderers/canvas/CanvasCoreRenderer.d.ts +0 -33
- package/dist/src/core/renderers/canvas/CanvasCoreRenderer.js +0 -250
- package/dist/src/core/renderers/canvas/CanvasCoreRenderer.js.map +0 -1
- package/dist/src/core/renderers/canvas/CanvasCoreTexture.d.ts +0 -16
- package/dist/src/core/renderers/canvas/CanvasCoreTexture.js +0 -123
- package/dist/src/core/renderers/canvas/CanvasCoreTexture.js.map +0 -1
- package/dist/src/core/renderers/canvas/shaders/UnsupportedShader.d.ts +0 -10
- package/dist/src/core/renderers/canvas/shaders/UnsupportedShader.js +0 -43
- package/dist/src/core/renderers/canvas/shaders/UnsupportedShader.js.map +0 -1
- package/dist/src/core/renderers/webgl/WebGlCoreCtxRenderTexture.d.ts +0 -12
- package/dist/src/core/renderers/webgl/WebGlCoreCtxRenderTexture.js +0 -55
- package/dist/src/core/renderers/webgl/WebGlCoreCtxRenderTexture.js.map +0 -1
- package/dist/src/core/renderers/webgl/WebGlCoreCtxSubTexture.d.ts +0 -9
- package/dist/src/core/renderers/webgl/WebGlCoreCtxSubTexture.js +0 -38
- package/dist/src/core/renderers/webgl/WebGlCoreCtxSubTexture.js.map +0 -1
- package/dist/src/core/renderers/webgl/WebGlCoreCtxTexture.d.ts +0 -57
- package/dist/src/core/renderers/webgl/WebGlCoreCtxTexture.js +0 -227
- package/dist/src/core/renderers/webgl/WebGlCoreCtxTexture.js.map +0 -1
- package/dist/src/core/renderers/webgl/WebGlCoreRenderOp.d.ts +0 -34
- package/dist/src/core/renderers/webgl/WebGlCoreRenderOp.js +0 -114
- package/dist/src/core/renderers/webgl/WebGlCoreRenderOp.js.map +0 -1
- package/dist/src/core/renderers/webgl/WebGlCoreRenderer.d.ts +0 -133
- package/dist/src/core/renderers/webgl/WebGlCoreRenderer.js +0 -613
- package/dist/src/core/renderers/webgl/WebGlCoreRenderer.js.map +0 -1
- package/dist/src/core/renderers/webgl/WebGlCoreShader.d.ts +0 -83
- package/dist/src/core/renderers/webgl/WebGlCoreShader.js +0 -231
- package/dist/src/core/renderers/webgl/WebGlCoreShader.js.map +0 -1
- package/dist/src/core/renderers/webgl/shaders/DefaultShader.d.ts +0 -9
- package/dist/src/core/renderers/webgl/shaders/DefaultShader.js +0 -87
- package/dist/src/core/renderers/webgl/shaders/DefaultShader.js.map +0 -1
- package/dist/src/core/renderers/webgl/shaders/DefaultShaderBatched.d.ts +0 -10
- package/dist/src/core/renderers/webgl/shaders/DefaultShaderBatched.js +0 -119
- package/dist/src/core/renderers/webgl/shaders/DefaultShaderBatched.js.map +0 -1
- package/dist/src/core/renderers/webgl/shaders/DynamicShader.d.ts +0 -29
- package/dist/src/core/renderers/webgl/shaders/DynamicShader.js +0 -413
- package/dist/src/core/renderers/webgl/shaders/DynamicShader.js.map +0 -1
- package/dist/src/core/renderers/webgl/shaders/RoundedRectangle.d.ts +0 -28
- package/dist/src/core/renderers/webgl/shaders/RoundedRectangle.js +0 -131
- package/dist/src/core/renderers/webgl/shaders/RoundedRectangle.js.map +0 -1
- package/dist/src/core/renderers/webgl/shaders/SdfShader.d.ts +0 -47
- package/dist/src/core/renderers/webgl/shaders/SdfShader.js +0 -160
- package/dist/src/core/renderers/webgl/shaders/SdfShader.js.map +0 -1
- package/dist/src/core/renderers/webgl/shaders/effects/BorderBottomEffect.d.ts +0 -31
- package/dist/src/core/renderers/webgl/shaders/effects/BorderBottomEffect.js +0 -71
- package/dist/src/core/renderers/webgl/shaders/effects/BorderBottomEffect.js.map +0 -1
- package/dist/src/core/renderers/webgl/shaders/effects/BorderEffect.d.ts +0 -30
- package/dist/src/core/renderers/webgl/shaders/effects/BorderEffect.js +0 -58
- package/dist/src/core/renderers/webgl/shaders/effects/BorderEffect.js.map +0 -1
- package/dist/src/core/renderers/webgl/shaders/effects/BorderLeftEffect.d.ts +0 -31
- package/dist/src/core/renderers/webgl/shaders/effects/BorderLeftEffect.js +0 -71
- package/dist/src/core/renderers/webgl/shaders/effects/BorderLeftEffect.js.map +0 -1
- package/dist/src/core/renderers/webgl/shaders/effects/BorderRightEffect.d.ts +0 -31
- package/dist/src/core/renderers/webgl/shaders/effects/BorderRightEffect.js +0 -71
- package/dist/src/core/renderers/webgl/shaders/effects/BorderRightEffect.js.map +0 -1
- package/dist/src/core/renderers/webgl/shaders/effects/BorderTopEffect.d.ts +0 -31
- package/dist/src/core/renderers/webgl/shaders/effects/BorderTopEffect.js +0 -71
- package/dist/src/core/renderers/webgl/shaders/effects/BorderTopEffect.js.map +0 -1
- package/dist/src/core/renderers/webgl/shaders/effects/EffectUtils.d.ts +0 -9
- package/dist/src/core/renderers/webgl/shaders/effects/EffectUtils.js +0 -136
- package/dist/src/core/renderers/webgl/shaders/effects/EffectUtils.js.map +0 -1
- package/dist/src/core/renderers/webgl/shaders/effects/FadeOutEffect.d.ts +0 -36
- package/dist/src/core/renderers/webgl/shaders/effects/FadeOutEffect.js +0 -85
- package/dist/src/core/renderers/webgl/shaders/effects/FadeOutEffect.js.map +0 -1
- package/dist/src/core/renderers/webgl/shaders/effects/GlitchEffect.d.ts +0 -45
- package/dist/src/core/renderers/webgl/shaders/effects/GlitchEffect.js +0 -104
- package/dist/src/core/renderers/webgl/shaders/effects/GlitchEffect.js.map +0 -1
- package/dist/src/core/renderers/webgl/shaders/effects/GrayscaleEffect.d.ts +0 -22
- package/dist/src/core/renderers/webgl/shaders/effects/GrayscaleEffect.js +0 -45
- package/dist/src/core/renderers/webgl/shaders/effects/GrayscaleEffect.js.map +0 -1
- package/dist/src/core/renderers/webgl/shaders/effects/HolePunchEffect.d.ts +0 -58
- package/dist/src/core/renderers/webgl/shaders/effects/HolePunchEffect.js +0 -80
- package/dist/src/core/renderers/webgl/shaders/effects/HolePunchEffect.js.map +0 -1
- package/dist/src/core/renderers/webgl/shaders/effects/LinearGradientEffect.d.ts +0 -35
- package/dist/src/core/renderers/webgl/shaders/effects/LinearGradientEffect.js +0 -129
- package/dist/src/core/renderers/webgl/shaders/effects/LinearGradientEffect.js.map +0 -1
- package/dist/src/core/renderers/webgl/shaders/effects/RadialGradientEffect.d.ts +0 -39
- package/dist/src/core/renderers/webgl/shaders/effects/RadialGradientEffect.js +0 -116
- package/dist/src/core/renderers/webgl/shaders/effects/RadialGradientEffect.js.map +0 -1
- package/dist/src/core/renderers/webgl/shaders/effects/RadialProgressEffect.d.ts +0 -61
- package/dist/src/core/renderers/webgl/shaders/effects/RadialProgressEffect.js +0 -127
- package/dist/src/core/renderers/webgl/shaders/effects/RadialProgressEffect.js.map +0 -1
- package/dist/src/core/renderers/webgl/shaders/effects/RadiusEffect.d.ts +0 -40
- package/dist/src/core/renderers/webgl/shaders/effects/RadiusEffect.js +0 -71
- package/dist/src/core/renderers/webgl/shaders/effects/RadiusEffect.js.map +0 -1
- package/dist/src/core/renderers/webgl/shaders/effects/ShaderEffect.d.ts +0 -115
- package/dist/src/core/renderers/webgl/shaders/effects/ShaderEffect.js +0 -61
- package/dist/src/core/renderers/webgl/shaders/effects/ShaderEffect.js.map +0 -1
- package/dist/src/core/shaders/templates/shaderUtils.js.map +0 -1
- package/dist/src/core/temp.d.ts +0 -1
- package/dist/src/core/temp.js +0 -77
- package/dist/src/core/temp.js.map +0 -1
- package/dist/src/main-api/DynamicShaderController.d.ts +0 -29
- package/dist/src/main-api/DynamicShaderController.js +0 -58
- package/dist/src/main-api/DynamicShaderController.js.map +0 -1
- package/dist/src/main-api/ShaderController.d.ts +0 -31
- package/dist/src/main-api/ShaderController.js +0 -37
- package/dist/src/main-api/ShaderController.js.map +0 -1
package/src/core/CoreNode.ts
CHANGED
|
@@ -21,7 +21,6 @@ import {
|
|
|
21
21
|
assertTruthy,
|
|
22
22
|
getNewId,
|
|
23
23
|
mergeColorAlphaPremultiplied,
|
|
24
|
-
isProductionEnvironment,
|
|
25
24
|
} from '../utils.js';
|
|
26
25
|
import type { TextureOptions } from './CoreTextureManager.js';
|
|
27
26
|
import type { CoreRenderer } from './renderers/CoreRenderer.js';
|
|
@@ -78,33 +77,24 @@ export enum UpdateType {
|
|
|
78
77
|
Children = 1,
|
|
79
78
|
|
|
80
79
|
/**
|
|
81
|
-
*
|
|
82
|
-
*
|
|
83
|
-
* @remarks
|
|
84
|
-
* CoreNode Properties Updated:
|
|
85
|
-
* - `scaleRotateTransform`
|
|
86
|
-
*/
|
|
87
|
-
ScaleRotate = 2,
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* Translate transform update (x/y/width/height/pivot/mount)
|
|
80
|
+
* localTransform
|
|
91
81
|
*
|
|
92
82
|
* @remarks
|
|
93
83
|
* CoreNode Properties Updated:
|
|
94
84
|
* - `localTransform`
|
|
95
85
|
*/
|
|
96
|
-
Local =
|
|
86
|
+
Local = 2,
|
|
97
87
|
|
|
98
88
|
/**
|
|
99
|
-
*
|
|
89
|
+
* globalTransform
|
|
100
90
|
*
|
|
101
|
-
* @remarks
|
|
91
|
+
* * @remarks
|
|
102
92
|
* CoreNode Properties Updated:
|
|
103
93
|
* - `globalTransform`
|
|
94
|
+
* - `renderBounds`
|
|
104
95
|
* - `renderCoords`
|
|
105
|
-
* - `renderBound`
|
|
106
96
|
*/
|
|
107
|
-
Global =
|
|
97
|
+
Global = 4,
|
|
108
98
|
|
|
109
99
|
/**
|
|
110
100
|
* Clipping rect update
|
|
@@ -113,7 +103,7 @@ export enum UpdateType {
|
|
|
113
103
|
* CoreNode Properties Updated:
|
|
114
104
|
* - `clippingRect`
|
|
115
105
|
*/
|
|
116
|
-
Clipping =
|
|
106
|
+
Clipping = 8,
|
|
117
107
|
|
|
118
108
|
/**
|
|
119
109
|
* Calculated ZIndex update
|
|
@@ -122,7 +112,7 @@ export enum UpdateType {
|
|
|
122
112
|
* CoreNode Properties Updated:
|
|
123
113
|
* - `calcZIndex`
|
|
124
114
|
*/
|
|
125
|
-
CalculatedZIndex =
|
|
115
|
+
CalculatedZIndex = 16,
|
|
126
116
|
|
|
127
117
|
/**
|
|
128
118
|
* Z-Index Sorted Children update
|
|
@@ -131,7 +121,7 @@ export enum UpdateType {
|
|
|
131
121
|
* CoreNode Properties Updated:
|
|
132
122
|
* - `children` (sorts children by their `calcZIndex`)
|
|
133
123
|
*/
|
|
134
|
-
ZIndexSortedChildren =
|
|
124
|
+
ZIndexSortedChildren = 32,
|
|
135
125
|
|
|
136
126
|
/**
|
|
137
127
|
* Premultiplied Colors update
|
|
@@ -143,7 +133,7 @@ export enum UpdateType {
|
|
|
143
133
|
* - `premultipliedColorBl`
|
|
144
134
|
* - `premultipliedColorBr`
|
|
145
135
|
*/
|
|
146
|
-
PremultipliedColors =
|
|
136
|
+
PremultipliedColors = 64,
|
|
147
137
|
|
|
148
138
|
/**
|
|
149
139
|
* World Alpha update
|
|
@@ -152,7 +142,7 @@ export enum UpdateType {
|
|
|
152
142
|
* CoreNode Properties Updated:
|
|
153
143
|
* - `worldAlpha` = `parent.worldAlpha` * `alpha`
|
|
154
144
|
*/
|
|
155
|
-
WorldAlpha =
|
|
145
|
+
WorldAlpha = 128,
|
|
156
146
|
|
|
157
147
|
/**
|
|
158
148
|
* Render State update
|
|
@@ -161,7 +151,7 @@ export enum UpdateType {
|
|
|
161
151
|
* CoreNode Properties Updated:
|
|
162
152
|
* - `renderState`
|
|
163
153
|
*/
|
|
164
|
-
RenderState =
|
|
154
|
+
RenderState = 256,
|
|
165
155
|
|
|
166
156
|
/**
|
|
167
157
|
* Is Renderable update
|
|
@@ -170,37 +160,37 @@ export enum UpdateType {
|
|
|
170
160
|
* CoreNode Properties Updated:
|
|
171
161
|
* - `isRenderable`
|
|
172
162
|
*/
|
|
173
|
-
IsRenderable =
|
|
163
|
+
IsRenderable = 512,
|
|
174
164
|
|
|
175
165
|
/**
|
|
176
166
|
* Render Texture update
|
|
177
167
|
*/
|
|
178
|
-
RenderTexture =
|
|
168
|
+
RenderTexture = 1024,
|
|
179
169
|
|
|
180
170
|
/**
|
|
181
171
|
* Track if parent has render texture
|
|
182
172
|
*/
|
|
183
|
-
ParentRenderTexture =
|
|
173
|
+
ParentRenderTexture = 2048,
|
|
184
174
|
|
|
185
175
|
/**
|
|
186
176
|
* Render Bounds update
|
|
187
177
|
*/
|
|
188
|
-
RenderBounds =
|
|
178
|
+
RenderBounds = 4096,
|
|
189
179
|
|
|
190
180
|
/**
|
|
191
|
-
*
|
|
181
|
+
* RecalcUniforms
|
|
192
182
|
*/
|
|
193
|
-
|
|
183
|
+
RecalcUniforms = 8192,
|
|
194
184
|
|
|
195
185
|
/**
|
|
196
|
-
*
|
|
186
|
+
* None
|
|
197
187
|
*/
|
|
198
|
-
|
|
188
|
+
None = 0,
|
|
199
189
|
|
|
200
190
|
/**
|
|
201
|
-
*
|
|
191
|
+
* All
|
|
202
192
|
*/
|
|
203
|
-
|
|
193
|
+
All = 16383,
|
|
204
194
|
}
|
|
205
195
|
|
|
206
196
|
/**
|
|
@@ -692,7 +682,7 @@ export interface CoreNodeProps {
|
|
|
692
682
|
* This is a big performance gain but may be disabled in cases where the width of the parent node is
|
|
693
683
|
* unknown and the render must process the child nodes regardless of the viewport status of the parent node
|
|
694
684
|
*
|
|
695
|
-
* @default
|
|
685
|
+
* @default true
|
|
696
686
|
*/
|
|
697
687
|
strictBounds: boolean;
|
|
698
688
|
}
|
|
@@ -729,11 +719,12 @@ export class CoreNode extends EventEmitter {
|
|
|
729
719
|
readonly props: CoreNodeProps;
|
|
730
720
|
|
|
731
721
|
private hasShaderUpdater = false;
|
|
722
|
+
private hasColorProps = false;
|
|
723
|
+
|
|
732
724
|
public updateType = UpdateType.All;
|
|
733
725
|
public childUpdateType = UpdateType.None;
|
|
734
726
|
|
|
735
727
|
public globalTransform?: Matrix3d;
|
|
736
|
-
public scaleRotateTransform?: Matrix3d;
|
|
737
728
|
public localTransform?: Matrix3d;
|
|
738
729
|
public sceneGlobalTransform?: Matrix3d;
|
|
739
730
|
public renderCoords?: RenderCoords;
|
|
@@ -767,17 +758,60 @@ export class CoreNode extends EventEmitter {
|
|
|
767
758
|
*/
|
|
768
759
|
public framebufferDimensions: Dimensions | null = null;
|
|
769
760
|
|
|
761
|
+
public destroyed = false;
|
|
762
|
+
|
|
770
763
|
constructor(readonly stage: Stage, props: CoreNodeProps) {
|
|
771
764
|
super();
|
|
772
765
|
|
|
773
|
-
this.props = {
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
766
|
+
const p = (this.props = {} as CoreNodeProps);
|
|
767
|
+
|
|
768
|
+
// Fast-path assign only known keys
|
|
769
|
+
p.x = props.x;
|
|
770
|
+
p.y = props.y;
|
|
771
|
+
p.width = props.width;
|
|
772
|
+
p.height = props.height;
|
|
773
|
+
p.alpha = props.alpha;
|
|
774
|
+
p.autosize = props.autosize;
|
|
775
|
+
p.clipping = props.clipping;
|
|
776
|
+
p.color = props.color;
|
|
777
|
+
|
|
778
|
+
p.colorTop = props.colorTop;
|
|
779
|
+
p.colorBottom = props.colorBottom;
|
|
780
|
+
p.colorLeft = props.colorLeft;
|
|
781
|
+
p.colorRight = props.colorRight;
|
|
782
|
+
p.colorTl = props.colorTl;
|
|
783
|
+
p.colorTr = props.colorTr;
|
|
784
|
+
p.colorBl = props.colorBl;
|
|
785
|
+
p.colorBr = props.colorBr;
|
|
786
|
+
|
|
787
|
+
p.scaleX = props.scaleX;
|
|
788
|
+
p.scaleY = props.scaleY;
|
|
789
|
+
p.rotation = props.rotation;
|
|
790
|
+
p.pivotX = props.pivotX;
|
|
791
|
+
p.pivotY = props.pivotY;
|
|
792
|
+
p.mountX = props.mountX;
|
|
793
|
+
p.mountY = props.mountY;
|
|
794
|
+
p.mount = props.mount;
|
|
795
|
+
p.pivot = props.pivot;
|
|
796
|
+
p.strictBounds = props.strictBounds;
|
|
797
|
+
|
|
798
|
+
p.zIndex = props.zIndex;
|
|
799
|
+
p.zIndexLocked = props.zIndexLocked;
|
|
800
|
+
p.textureOptions = props.textureOptions;
|
|
801
|
+
|
|
802
|
+
p.data = props.data;
|
|
803
|
+
p.imageType = props.imageType;
|
|
804
|
+
p.srcX = props.srcX;
|
|
805
|
+
p.srcY = props.srcY;
|
|
806
|
+
p.srcWidth = props.srcWidth;
|
|
807
|
+
p.srcHeight = props.srcHeight;
|
|
808
|
+
|
|
809
|
+
p.parent = null;
|
|
810
|
+
p.texture = null;
|
|
811
|
+
p.shader = null;
|
|
812
|
+
p.src = null;
|
|
813
|
+
p.rtt = false;
|
|
814
|
+
p.boundsMargin = null;
|
|
781
815
|
|
|
782
816
|
// Assign props to instances
|
|
783
817
|
this.parent = props.parent;
|
|
@@ -785,42 +819,27 @@ export class CoreNode extends EventEmitter {
|
|
|
785
819
|
this.shader = props.shader;
|
|
786
820
|
this.src = props.src;
|
|
787
821
|
this.rtt = props.rtt;
|
|
822
|
+
this.boundsMargin = props.boundsMargin;
|
|
788
823
|
this.interactive = props.interactive;
|
|
789
824
|
|
|
790
|
-
if (props.boundsMargin) {
|
|
791
|
-
this.boundsMargin = Array.isArray(props.boundsMargin)
|
|
792
|
-
? props.boundsMargin
|
|
793
|
-
: [
|
|
794
|
-
props.boundsMargin,
|
|
795
|
-
props.boundsMargin,
|
|
796
|
-
props.boundsMargin,
|
|
797
|
-
props.boundsMargin,
|
|
798
|
-
];
|
|
799
|
-
}
|
|
800
|
-
|
|
801
825
|
this.setUpdateType(
|
|
802
|
-
UpdateType.
|
|
803
|
-
UpdateType.Local |
|
|
804
|
-
UpdateType.RenderBounds |
|
|
805
|
-
UpdateType.RenderState,
|
|
826
|
+
UpdateType.Local | UpdateType.RenderBounds | UpdateType.RenderState,
|
|
806
827
|
);
|
|
807
828
|
|
|
808
829
|
// if the default texture isn't loaded yet, wait for it to load
|
|
809
830
|
// this only happens when the node is created before the stage is ready
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
) {
|
|
814
|
-
this.stage.defaultTexture.once('loaded', () => {
|
|
815
|
-
this.setUpdateType(UpdateType.IsRenderable);
|
|
816
|
-
});
|
|
831
|
+
const dt = this.stage.defaultTexture;
|
|
832
|
+
if (dt !== null && dt.state !== 'loaded') {
|
|
833
|
+
dt.once('loaded', () => this.setUpdateType(UpdateType.IsRenderable));
|
|
817
834
|
}
|
|
818
835
|
}
|
|
819
836
|
|
|
820
837
|
//#region Textures
|
|
821
838
|
loadTexture(): void {
|
|
822
839
|
const { texture } = this.props;
|
|
823
|
-
|
|
840
|
+
if (!texture) {
|
|
841
|
+
return;
|
|
842
|
+
}
|
|
824
843
|
|
|
825
844
|
// If texture is already loaded / failed, trigger loaded event manually
|
|
826
845
|
// so that users get a consistent event experience.
|
|
@@ -848,11 +867,9 @@ export class CoreNode extends EventEmitter {
|
|
|
848
867
|
}
|
|
849
868
|
|
|
850
869
|
if (texture.state === 'loaded') {
|
|
851
|
-
|
|
852
|
-
this.onTextureLoaded(texture, texture.dimensions);
|
|
870
|
+
this.onTextureLoaded(texture, texture.dimensions!);
|
|
853
871
|
} else if (texture.state === 'failed') {
|
|
854
|
-
|
|
855
|
-
this.onTextureFailed(texture, texture.error);
|
|
872
|
+
this.onTextureFailed(texture, texture.error!);
|
|
856
873
|
} else if (texture.state === 'freed') {
|
|
857
874
|
this.onTextureFreed(texture);
|
|
858
875
|
}
|
|
@@ -860,12 +877,15 @@ export class CoreNode extends EventEmitter {
|
|
|
860
877
|
}
|
|
861
878
|
|
|
862
879
|
unloadTexture(): void {
|
|
863
|
-
if (this.texture
|
|
864
|
-
|
|
865
|
-
this.texture.off('failed', this.onTextureFailed);
|
|
866
|
-
this.texture.off('freed', this.onTextureFreed);
|
|
867
|
-
this.texture.setRenderableOwner(this, false);
|
|
880
|
+
if (this.texture === null) {
|
|
881
|
+
return;
|
|
868
882
|
}
|
|
883
|
+
|
|
884
|
+
const texture = this.texture;
|
|
885
|
+
texture.off('loaded', this.onTextureLoaded);
|
|
886
|
+
texture.off('failed', this.onTextureFailed);
|
|
887
|
+
texture.off('freed', this.onTextureFreed);
|
|
888
|
+
texture.setRenderableOwner(this, false);
|
|
869
889
|
}
|
|
870
890
|
|
|
871
891
|
autosizeNode(dimensions: Dimensions) {
|
|
@@ -903,6 +923,9 @@ export class CoreNode extends EventEmitter {
|
|
|
903
923
|
};
|
|
904
924
|
|
|
905
925
|
private onTextureFailed: TextureFailedEventHandler = (_, error) => {
|
|
926
|
+
// immediately set isRenderable to false, so that we handle the error
|
|
927
|
+
// without waiting for the next frame loop
|
|
928
|
+
this.isRenderable = false;
|
|
906
929
|
this.setUpdateType(UpdateType.IsRenderable);
|
|
907
930
|
|
|
908
931
|
// If parent has a render texture, flag that we need to update
|
|
@@ -917,6 +940,9 @@ export class CoreNode extends EventEmitter {
|
|
|
917
940
|
};
|
|
918
941
|
|
|
919
942
|
private onTextureFreed: TextureFreedEventHandler = () => {
|
|
943
|
+
// immediately set isRenderable to false, so that we handle the error
|
|
944
|
+
// without waiting for the next frame loop
|
|
945
|
+
this.isRenderable = false;
|
|
920
946
|
this.setUpdateType(UpdateType.IsRenderable);
|
|
921
947
|
|
|
922
948
|
// If parent has a render texture, flag that we need to update
|
|
@@ -944,46 +970,30 @@ export class CoreNode extends EventEmitter {
|
|
|
944
970
|
const parent = this.props.parent;
|
|
945
971
|
if (!parent) return;
|
|
946
972
|
|
|
947
|
-
|
|
948
|
-
// Inform the parent if it doesn’t already have a child update
|
|
949
|
-
parent.setUpdateType(UpdateType.Children);
|
|
950
|
-
}
|
|
973
|
+
parent.setUpdateType(UpdateType.Children);
|
|
951
974
|
}
|
|
952
975
|
|
|
953
976
|
sortChildren() {
|
|
954
977
|
this.children.sort((a, b) => a.calcZIndex - b.calcZIndex);
|
|
955
978
|
}
|
|
956
979
|
|
|
957
|
-
updateScaleRotateTransform() {
|
|
958
|
-
const { rotation, scaleX, scaleY } = this.props;
|
|
959
|
-
|
|
960
|
-
// optimize simple translation cases
|
|
961
|
-
if (rotation === 0 && scaleX === 1 && scaleY === 1) {
|
|
962
|
-
this.scaleRotateTransform = undefined;
|
|
963
|
-
return;
|
|
964
|
-
}
|
|
965
|
-
|
|
966
|
-
this.scaleRotateTransform = Matrix3d.rotate(
|
|
967
|
-
rotation,
|
|
968
|
-
this.scaleRotateTransform,
|
|
969
|
-
).scale(scaleX, scaleY);
|
|
970
|
-
}
|
|
971
|
-
|
|
972
980
|
updateLocalTransform() {
|
|
973
|
-
const
|
|
974
|
-
const
|
|
975
|
-
const
|
|
981
|
+
const p = this.props;
|
|
982
|
+
const { x, y, width, height } = p;
|
|
983
|
+
const mountTranslateX = p.mountX * width;
|
|
984
|
+
const mountTranslateY = p.mountY * height;
|
|
976
985
|
|
|
977
|
-
if (
|
|
978
|
-
const pivotTranslateX =
|
|
979
|
-
const pivotTranslateY =
|
|
986
|
+
if (p.rotation !== 0 || p.scaleX !== 1 || p.scaleY !== 1) {
|
|
987
|
+
const pivotTranslateX = p.pivotX * width;
|
|
988
|
+
const pivotTranslateY = p.pivotY * height;
|
|
980
989
|
|
|
981
990
|
this.localTransform = Matrix3d.translate(
|
|
982
991
|
x - mountTranslateX + pivotTranslateX,
|
|
983
992
|
y - mountTranslateY + pivotTranslateY,
|
|
984
993
|
this.localTransform,
|
|
985
994
|
)
|
|
986
|
-
.
|
|
995
|
+
.rotate(p.rotation)
|
|
996
|
+
.scale(p.scaleX, p.scaleY)
|
|
987
997
|
.translate(-pivotTranslateX, -pivotTranslateY);
|
|
988
998
|
} else {
|
|
989
999
|
this.localTransform = Matrix3d.translate(
|
|
@@ -994,11 +1004,11 @@ export class CoreNode extends EventEmitter {
|
|
|
994
1004
|
}
|
|
995
1005
|
|
|
996
1006
|
// Handle 'contain' resize mode
|
|
997
|
-
const texture =
|
|
1007
|
+
const texture = p.texture;
|
|
998
1008
|
if (
|
|
999
1009
|
texture &&
|
|
1000
1010
|
texture.dimensions &&
|
|
1001
|
-
|
|
1011
|
+
p.textureOptions.resizeMode?.type === 'contain'
|
|
1002
1012
|
) {
|
|
1003
1013
|
let resizeModeScaleX = 1;
|
|
1004
1014
|
let resizeModeScaleY = 1;
|
|
@@ -1030,8 +1040,6 @@ export class CoreNode extends EventEmitter {
|
|
|
1030
1040
|
.translate(extraX, extraY)
|
|
1031
1041
|
.scale(resizeModeScaleX, resizeModeScaleY);
|
|
1032
1042
|
}
|
|
1033
|
-
|
|
1034
|
-
this.setUpdateType(UpdateType.Global);
|
|
1035
1043
|
}
|
|
1036
1044
|
|
|
1037
1045
|
/**
|
|
@@ -1039,27 +1047,34 @@ export class CoreNode extends EventEmitter {
|
|
|
1039
1047
|
* @param delta
|
|
1040
1048
|
*/
|
|
1041
1049
|
update(delta: number, parentClippingRect: RectWithValid): void {
|
|
1042
|
-
if (this.updateType
|
|
1043
|
-
|
|
1044
|
-
this.setUpdateType(UpdateType.Local);
|
|
1050
|
+
if (this.updateType === UpdateType.None) {
|
|
1051
|
+
return;
|
|
1045
1052
|
}
|
|
1046
1053
|
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1054
|
+
const props = this.props;
|
|
1055
|
+
const parent = props.parent;
|
|
1056
|
+
const parentHasRenderTexture = this.parentHasRenderTexture;
|
|
1057
|
+
const hasParent = props.parent !== null;
|
|
1051
1058
|
|
|
1052
|
-
const parent = this.props.parent;
|
|
1053
1059
|
let renderState: CoreNodeRenderState | null = null;
|
|
1054
1060
|
|
|
1061
|
+
let updateType = this.updateType;
|
|
1062
|
+
let childUpdateType = this.childUpdateType;
|
|
1063
|
+
let updateParent = false;
|
|
1064
|
+
|
|
1065
|
+
if (updateType & UpdateType.Local) {
|
|
1066
|
+
this.updateLocalTransform();
|
|
1067
|
+
|
|
1068
|
+
updateType |= UpdateType.Global;
|
|
1069
|
+
updateParent = hasParent;
|
|
1070
|
+
}
|
|
1071
|
+
|
|
1055
1072
|
// Handle specific RTT updates at this node level
|
|
1056
|
-
if (
|
|
1073
|
+
if (updateType & UpdateType.RenderTexture && this.rtt === true) {
|
|
1057
1074
|
this.hasRTTupdates = true;
|
|
1058
1075
|
}
|
|
1059
1076
|
|
|
1060
|
-
if (
|
|
1061
|
-
assertTruthy(this.localTransform);
|
|
1062
|
-
|
|
1077
|
+
if (updateType & UpdateType.Global) {
|
|
1063
1078
|
if (this.parentHasRenderTexture === true && parent?.rtt === true) {
|
|
1064
1079
|
// we are at the start of the RTT chain, so we need to reset the globalTransform
|
|
1065
1080
|
// for correct RTT rendering
|
|
@@ -1068,7 +1083,7 @@ export class CoreNode extends EventEmitter {
|
|
|
1068
1083
|
// Maintain a full scene global transform for bounds detection
|
|
1069
1084
|
this.sceneGlobalTransform = Matrix3d.copy(
|
|
1070
1085
|
parent?.globalTransform || Matrix3d.identity(),
|
|
1071
|
-
).multiply(this.localTransform);
|
|
1086
|
+
).multiply(this.localTransform!);
|
|
1072
1087
|
} else if (
|
|
1073
1088
|
this.parentHasRenderTexture === true &&
|
|
1074
1089
|
parent?.rtt === false
|
|
@@ -1077,50 +1092,53 @@ export class CoreNode extends EventEmitter {
|
|
|
1077
1092
|
// so we need to propogate the sceneGlobalTransform of the parent
|
|
1078
1093
|
// to maintain a full scene global transform for bounds detection
|
|
1079
1094
|
this.sceneGlobalTransform = Matrix3d.copy(
|
|
1080
|
-
parent?.sceneGlobalTransform || this.localTransform
|
|
1081
|
-
).multiply(this.localTransform);
|
|
1095
|
+
parent?.sceneGlobalTransform || this.localTransform!,
|
|
1096
|
+
).multiply(this.localTransform!);
|
|
1082
1097
|
|
|
1083
1098
|
this.globalTransform = Matrix3d.copy(
|
|
1084
|
-
parent?.globalTransform || this.localTransform
|
|
1099
|
+
parent?.globalTransform || this.localTransform!,
|
|
1085
1100
|
this.globalTransform,
|
|
1086
1101
|
);
|
|
1087
1102
|
} else {
|
|
1088
1103
|
this.globalTransform = Matrix3d.copy(
|
|
1089
|
-
parent?.globalTransform || this.localTransform
|
|
1104
|
+
parent?.globalTransform || this.localTransform!,
|
|
1090
1105
|
this.globalTransform,
|
|
1091
1106
|
);
|
|
1092
1107
|
}
|
|
1093
1108
|
|
|
1094
1109
|
if (parent !== null) {
|
|
1095
|
-
this.globalTransform.multiply(this.localTransform);
|
|
1110
|
+
this.globalTransform.multiply(this.localTransform!);
|
|
1096
1111
|
}
|
|
1097
1112
|
this.calculateRenderCoords();
|
|
1098
1113
|
this.updateBoundingRect();
|
|
1099
1114
|
|
|
1100
|
-
|
|
1115
|
+
updateType |=
|
|
1101
1116
|
UpdateType.RenderState |
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1117
|
+
UpdateType.Children |
|
|
1118
|
+
UpdateType.RecalcUniforms;
|
|
1119
|
+
updateParent = hasParent;
|
|
1120
|
+
childUpdateType |= UpdateType.Global;
|
|
1106
1121
|
|
|
1107
1122
|
if (this.clipping === true) {
|
|
1108
|
-
|
|
1109
|
-
|
|
1123
|
+
updateType |= UpdateType.Clipping | UpdateType.RenderBounds;
|
|
1124
|
+
updateParent = hasParent;
|
|
1125
|
+
childUpdateType |= UpdateType.RenderBounds;
|
|
1110
1126
|
}
|
|
1111
1127
|
}
|
|
1112
1128
|
|
|
1113
|
-
if (
|
|
1129
|
+
if (updateType & UpdateType.RenderBounds) {
|
|
1114
1130
|
this.createRenderBounds();
|
|
1115
|
-
this.setUpdateType(UpdateType.RenderState);
|
|
1116
|
-
this.setUpdateType(UpdateType.Children);
|
|
1117
1131
|
|
|
1118
|
-
|
|
1132
|
+
updateType |= UpdateType.RenderState | UpdateType.Children;
|
|
1133
|
+
updateParent = hasParent;
|
|
1134
|
+
childUpdateType |= UpdateType.RenderBounds;
|
|
1119
1135
|
}
|
|
1120
1136
|
|
|
1121
|
-
if (
|
|
1137
|
+
if (updateType & UpdateType.RenderState) {
|
|
1122
1138
|
renderState = this.checkRenderBounds();
|
|
1123
|
-
|
|
1139
|
+
|
|
1140
|
+
updateType |= UpdateType.IsRenderable;
|
|
1141
|
+
updateParent = hasParent;
|
|
1124
1142
|
|
|
1125
1143
|
// if we're not going out of bounds, update the render state
|
|
1126
1144
|
// this is done so the update loop can finish before we mark a node
|
|
@@ -1130,96 +1148,98 @@ export class CoreNode extends EventEmitter {
|
|
|
1130
1148
|
}
|
|
1131
1149
|
}
|
|
1132
1150
|
|
|
1133
|
-
if (
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
this.worldAlpha = this.props.alpha;
|
|
1138
|
-
}
|
|
1139
|
-
this.setUpdateType(
|
|
1151
|
+
if (updateType & UpdateType.WorldAlpha) {
|
|
1152
|
+
this.worldAlpha = ((parent && parent.worldAlpha) || 1) * props.alpha;
|
|
1153
|
+
updateType |=
|
|
1154
|
+
UpdateType.PremultipliedColors |
|
|
1140
1155
|
UpdateType.Children |
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
this.childUpdateType |= UpdateType.WorldAlpha;
|
|
1156
|
+
UpdateType.IsRenderable;
|
|
1157
|
+
updateParent = hasParent;
|
|
1158
|
+
childUpdateType |= UpdateType.WorldAlpha;
|
|
1145
1159
|
}
|
|
1146
1160
|
|
|
1147
|
-
if (
|
|
1161
|
+
if (updateType & UpdateType.IsRenderable) {
|
|
1148
1162
|
this.updateIsRenderable();
|
|
1149
1163
|
}
|
|
1150
1164
|
|
|
1151
|
-
if (
|
|
1165
|
+
if (updateType & UpdateType.Clipping) {
|
|
1152
1166
|
this.calculateClippingRect(parentClippingRect);
|
|
1153
|
-
|
|
1167
|
+
updateType |= UpdateType.Children;
|
|
1168
|
+
updateParent = hasParent;
|
|
1154
1169
|
|
|
1155
|
-
|
|
1156
|
-
this.childUpdateType |= UpdateType.RenderBounds;
|
|
1170
|
+
childUpdateType |= UpdateType.Clipping | UpdateType.RenderBounds;
|
|
1157
1171
|
}
|
|
1158
1172
|
|
|
1159
|
-
if (
|
|
1160
|
-
|
|
1161
|
-
this.props.colorTl,
|
|
1162
|
-
this.worldAlpha,
|
|
1163
|
-
true,
|
|
1164
|
-
);
|
|
1173
|
+
if (updateType & UpdateType.PremultipliedColors) {
|
|
1174
|
+
const alpha = this.worldAlpha;
|
|
1165
1175
|
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
)
|
|
1176
|
+
const tl = props.colorTl;
|
|
1177
|
+
const tr = props.colorTr;
|
|
1178
|
+
const bl = props.colorBl;
|
|
1179
|
+
const br = props.colorBr;
|
|
1180
|
+
|
|
1181
|
+
// Fast equality check (covers all 4 corners)
|
|
1182
|
+
const same = tl === tr && tl === bl && tl === br;
|
|
1183
|
+
|
|
1184
|
+
const merged = mergeColorAlphaPremultiplied(tl, alpha, true);
|
|
1185
|
+
|
|
1186
|
+
this.premultipliedColorTl = merged;
|
|
1187
|
+
|
|
1188
|
+
if (same) {
|
|
1172
1189
|
this.premultipliedColorTr =
|
|
1173
1190
|
this.premultipliedColorBl =
|
|
1174
1191
|
this.premultipliedColorBr =
|
|
1175
|
-
|
|
1192
|
+
merged;
|
|
1176
1193
|
} else {
|
|
1177
1194
|
this.premultipliedColorTr = mergeColorAlphaPremultiplied(
|
|
1178
|
-
|
|
1179
|
-
|
|
1195
|
+
tr,
|
|
1196
|
+
alpha,
|
|
1180
1197
|
true,
|
|
1181
1198
|
);
|
|
1182
1199
|
this.premultipliedColorBl = mergeColorAlphaPremultiplied(
|
|
1183
|
-
|
|
1184
|
-
|
|
1200
|
+
bl,
|
|
1201
|
+
alpha,
|
|
1185
1202
|
true,
|
|
1186
1203
|
);
|
|
1187
1204
|
this.premultipliedColorBr = mergeColorAlphaPremultiplied(
|
|
1188
|
-
|
|
1189
|
-
|
|
1205
|
+
br,
|
|
1206
|
+
alpha,
|
|
1190
1207
|
true,
|
|
1191
1208
|
);
|
|
1192
1209
|
}
|
|
1193
1210
|
}
|
|
1194
1211
|
|
|
1212
|
+
if (updateParent === true) {
|
|
1213
|
+
parent!.setUpdateType(UpdateType.Children);
|
|
1214
|
+
}
|
|
1195
1215
|
// No need to update zIndex if there is no parent
|
|
1196
|
-
if (
|
|
1216
|
+
if (updateType & UpdateType.CalculatedZIndex && parent !== null) {
|
|
1197
1217
|
this.calculateZIndex();
|
|
1198
1218
|
// Tell parent to re-sort children
|
|
1199
1219
|
parent.setUpdateType(UpdateType.ZIndexSortedChildren);
|
|
1200
1220
|
}
|
|
1201
1221
|
|
|
1202
1222
|
if (
|
|
1203
|
-
|
|
1223
|
+
props.strictBounds === true &&
|
|
1204
1224
|
this.renderState === CoreNodeRenderState.OutOfBounds
|
|
1205
1225
|
) {
|
|
1206
|
-
|
|
1226
|
+
updateType &= ~UpdateType.RenderBounds; // remove render bounds update
|
|
1207
1227
|
return;
|
|
1208
1228
|
}
|
|
1209
1229
|
|
|
1210
1230
|
if (
|
|
1211
|
-
|
|
1231
|
+
updateType & UpdateType.RecalcUniforms &&
|
|
1212
1232
|
this.hasShaderUpdater === true
|
|
1213
1233
|
) {
|
|
1214
1234
|
//this exists because the boolean hasShaderUpdater === true
|
|
1215
1235
|
this.shader!.update!();
|
|
1216
1236
|
}
|
|
1217
1237
|
|
|
1218
|
-
if (
|
|
1238
|
+
if (updateType & UpdateType.Children && this.children.length > 0) {
|
|
1219
1239
|
for (let i = 0, length = this.children.length; i < length; i++) {
|
|
1220
1240
|
const child = this.children[i] as CoreNode;
|
|
1221
1241
|
|
|
1222
|
-
child.setUpdateType(
|
|
1242
|
+
child.setUpdateType(childUpdateType);
|
|
1223
1243
|
|
|
1224
1244
|
if (child.updateType === 0) {
|
|
1225
1245
|
continue;
|
|
@@ -1241,15 +1261,15 @@ export class CoreNode extends EventEmitter {
|
|
|
1241
1261
|
}
|
|
1242
1262
|
|
|
1243
1263
|
// If the node has an RTT parent and requires a texture re-render, inform the RTT parent
|
|
1244
|
-
// if (this.parentHasRenderTexture &&
|
|
1264
|
+
// if (this.parentHasRenderTexture && updateType & UpdateType.RenderTexture) {
|
|
1245
1265
|
// @TODO have a more scoped down updateType for RTT updates
|
|
1246
|
-
if (
|
|
1266
|
+
if (parentHasRenderTexture === true) {
|
|
1247
1267
|
this.notifyParentRTTOfUpdate();
|
|
1248
1268
|
}
|
|
1249
1269
|
|
|
1250
1270
|
// Sorting children MUST happen after children have been updated so
|
|
1251
1271
|
// that they have the oppotunity to update their calculated zIndex.
|
|
1252
|
-
if (
|
|
1272
|
+
if (updateType & UpdateType.ZIndexSortedChildren) {
|
|
1253
1273
|
// reorder z-index
|
|
1254
1274
|
this.sortChildren();
|
|
1255
1275
|
}
|
|
@@ -1273,7 +1293,6 @@ export class CoreNode extends EventEmitter {
|
|
|
1273
1293
|
// notify children that we are going out of bounds
|
|
1274
1294
|
// we have to do this now before we stop processing the render tree
|
|
1275
1295
|
this.notifyChildrenRTTOfUpdate(renderState);
|
|
1276
|
-
// this.childUpdateType |= UpdateType.RenderState;
|
|
1277
1296
|
}
|
|
1278
1297
|
}
|
|
1279
1298
|
|
|
@@ -1320,20 +1339,16 @@ export class CoreNode extends EventEmitter {
|
|
|
1320
1339
|
}
|
|
1321
1340
|
|
|
1322
1341
|
checkRenderBounds(): CoreNodeRenderState {
|
|
1323
|
-
|
|
1324
|
-
assertTruthy(this.strictBound);
|
|
1325
|
-
assertTruthy(this.preloadBound);
|
|
1326
|
-
|
|
1327
|
-
if (boundInsideBound(this.renderBound, this.strictBound)) {
|
|
1342
|
+
if (boundInsideBound(this.renderBound!, this.strictBound!)) {
|
|
1328
1343
|
return CoreNodeRenderState.InViewport;
|
|
1329
1344
|
}
|
|
1330
1345
|
|
|
1331
|
-
if (boundInsideBound(this.renderBound
|
|
1346
|
+
if (boundInsideBound(this.renderBound!, this.preloadBound!)) {
|
|
1332
1347
|
return CoreNodeRenderState.InBounds;
|
|
1333
1348
|
}
|
|
1334
1349
|
|
|
1335
1350
|
// check if we're larger then our parent, we're definitely in the viewport
|
|
1336
|
-
if (boundLargeThanBound(this.renderBound
|
|
1351
|
+
if (boundLargeThanBound(this.renderBound!, this.strictBound!)) {
|
|
1337
1352
|
return CoreNodeRenderState.InViewport;
|
|
1338
1353
|
}
|
|
1339
1354
|
|
|
@@ -1349,11 +1364,8 @@ export class CoreNode extends EventEmitter {
|
|
|
1349
1364
|
}
|
|
1350
1365
|
|
|
1351
1366
|
updateBoundingRect() {
|
|
1352
|
-
const transform = this.sceneGlobalTransform || this.globalTransform
|
|
1353
|
-
const renderCoords = this.sceneRenderCoords || this.renderCoords
|
|
1354
|
-
|
|
1355
|
-
assertTruthy(transform);
|
|
1356
|
-
assertTruthy(renderCoords);
|
|
1367
|
+
const transform = (this.sceneGlobalTransform || this.globalTransform)!;
|
|
1368
|
+
const renderCoords = (this.sceneRenderCoords || this.renderCoords)!;
|
|
1357
1369
|
|
|
1358
1370
|
if (transform.tb === 0 || transform.tc === 0) {
|
|
1359
1371
|
this.renderBound = createBound(
|
|
@@ -1457,7 +1469,10 @@ export class CoreNode extends EventEmitter {
|
|
|
1457
1469
|
let needsTextureOwnership = false;
|
|
1458
1470
|
|
|
1459
1471
|
// If the node is out of bounds or has an alpha of 0, it is not renderable
|
|
1460
|
-
if (
|
|
1472
|
+
if (
|
|
1473
|
+
this.worldAlpha === 0 ||
|
|
1474
|
+
this.renderState <= CoreNodeRenderState.OutOfBounds
|
|
1475
|
+
) {
|
|
1461
1476
|
this.updateTextureOwnership(false);
|
|
1462
1477
|
this.setRenderable(false);
|
|
1463
1478
|
return;
|
|
@@ -1469,8 +1484,10 @@ export class CoreNode extends EventEmitter {
|
|
|
1469
1484
|
// we're only renderable if the texture state is loaded
|
|
1470
1485
|
newIsRenderable = this.texture.state === 'loaded';
|
|
1471
1486
|
} else if (
|
|
1472
|
-
|
|
1473
|
-
this.
|
|
1487
|
+
// check shader
|
|
1488
|
+
(this.props.shader !== null || this.hasColorProps === true) &&
|
|
1489
|
+
// check dimensions
|
|
1490
|
+
(this.props.width !== 0 && this.props.height !== 0) === true
|
|
1474
1491
|
) {
|
|
1475
1492
|
// This mean we have dimensions and a color set, so we can render a ColorTexture
|
|
1476
1493
|
if (
|
|
@@ -1485,17 +1502,6 @@ export class CoreNode extends EventEmitter {
|
|
|
1485
1502
|
this.setRenderable(newIsRenderable);
|
|
1486
1503
|
}
|
|
1487
1504
|
|
|
1488
|
-
/**
|
|
1489
|
-
* Checks if the node is renderable based on world alpha, dimensions and out of bounds status.
|
|
1490
|
-
*/
|
|
1491
|
-
checkBasicRenderability(): boolean {
|
|
1492
|
-
if (this.worldAlpha === 0 || this.isOutOfBounds() === true) {
|
|
1493
|
-
return false;
|
|
1494
|
-
} else {
|
|
1495
|
-
return true;
|
|
1496
|
-
}
|
|
1497
|
-
}
|
|
1498
|
-
|
|
1499
1505
|
/**
|
|
1500
1506
|
* Sets the renderable state and triggers changes if necessary.
|
|
1501
1507
|
* @param isRenderable - The new renderable state
|
|
@@ -1518,44 +1524,16 @@ export class CoreNode extends EventEmitter {
|
|
|
1518
1524
|
this.texture?.setRenderableOwner(this, isRenderable);
|
|
1519
1525
|
}
|
|
1520
1526
|
|
|
1521
|
-
/**
|
|
1522
|
-
* Checks if the node is out of the viewport bounds.
|
|
1523
|
-
*/
|
|
1524
|
-
isOutOfBounds(): boolean {
|
|
1525
|
-
return this.renderState <= CoreNodeRenderState.OutOfBounds;
|
|
1526
|
-
}
|
|
1527
|
-
|
|
1528
|
-
/**
|
|
1529
|
-
* Checks if the node has dimensions (width/height)
|
|
1530
|
-
*/
|
|
1531
|
-
hasDimensions(): boolean {
|
|
1532
|
-
return this.props.width !== 0 && this.props.height !== 0;
|
|
1533
|
-
}
|
|
1534
|
-
|
|
1535
|
-
/**
|
|
1536
|
-
* Checks if the node has any color properties set.
|
|
1537
|
-
*/
|
|
1538
|
-
hasColorProperties(): boolean {
|
|
1539
|
-
return (
|
|
1540
|
-
this.props.color !== 0 ||
|
|
1541
|
-
this.props.colorTop !== 0 ||
|
|
1542
|
-
this.props.colorBottom !== 0 ||
|
|
1543
|
-
this.props.colorLeft !== 0 ||
|
|
1544
|
-
this.props.colorRight !== 0 ||
|
|
1545
|
-
this.props.colorTl !== 0 ||
|
|
1546
|
-
this.props.colorTr !== 0 ||
|
|
1547
|
-
this.props.colorBl !== 0 ||
|
|
1548
|
-
this.props.colorBr !== 0
|
|
1549
|
-
);
|
|
1550
|
-
}
|
|
1551
|
-
|
|
1552
|
-
hasShader(): boolean {
|
|
1553
|
-
return this.props.shader !== null;
|
|
1554
|
-
}
|
|
1555
|
-
|
|
1556
1527
|
calculateRenderCoords() {
|
|
1557
1528
|
const { width, height } = this;
|
|
1558
|
-
|
|
1529
|
+
|
|
1530
|
+
const g = this.globalTransform!;
|
|
1531
|
+
const tx = g.tx,
|
|
1532
|
+
ty = g.ty,
|
|
1533
|
+
ta = g.ta,
|
|
1534
|
+
tb = g.tb,
|
|
1535
|
+
tc = g.tc,
|
|
1536
|
+
td = g.td;
|
|
1559
1537
|
if (tb === 0 && tc === 0) {
|
|
1560
1538
|
const minX = tx;
|
|
1561
1539
|
const maxX = tx + width * ta;
|
|
@@ -1653,16 +1631,15 @@ export class CoreNode extends EventEmitter {
|
|
|
1653
1631
|
* Finally, the node's parentClippingRect and clippingRect properties are updated.
|
|
1654
1632
|
*/
|
|
1655
1633
|
calculateClippingRect(parentClippingRect: RectWithValid) {
|
|
1656
|
-
assertTruthy(this.globalTransform);
|
|
1657
1634
|
const { clippingRect, props, globalTransform: gt } = this;
|
|
1658
1635
|
const { clipping } = props;
|
|
1659
|
-
const isRotated = gt
|
|
1636
|
+
const isRotated = gt!.tb !== 0 || gt!.tc !== 0;
|
|
1660
1637
|
|
|
1661
1638
|
if (clipping === true && isRotated === false) {
|
|
1662
|
-
clippingRect.x = gt
|
|
1663
|
-
clippingRect.y = gt
|
|
1664
|
-
clippingRect.width = this.width * gt
|
|
1665
|
-
clippingRect.height = this.height * gt
|
|
1639
|
+
clippingRect.x = gt!.tx;
|
|
1640
|
+
clippingRect.y = gt!.ty;
|
|
1641
|
+
clippingRect.width = this.width * gt!.ta;
|
|
1642
|
+
clippingRect.height = this.height * gt!.td;
|
|
1666
1643
|
clippingRect.valid = true;
|
|
1667
1644
|
} else {
|
|
1668
1645
|
clippingRect.valid = false;
|
|
@@ -1694,81 +1671,76 @@ export class CoreNode extends EventEmitter {
|
|
|
1694
1671
|
* Destroy the node and cleanup all resources
|
|
1695
1672
|
*/
|
|
1696
1673
|
destroy(): void {
|
|
1697
|
-
this.
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
this.isRenderable = false;
|
|
1674
|
+
if (this.destroyed === true) {
|
|
1675
|
+
return;
|
|
1676
|
+
}
|
|
1701
1677
|
|
|
1702
|
-
this.
|
|
1703
|
-
this.renderBound = undefined;
|
|
1704
|
-
this.strictBound = undefined;
|
|
1705
|
-
this.preloadBound = undefined;
|
|
1706
|
-
this.globalTransform = undefined;
|
|
1707
|
-
this.scaleRotateTransform = undefined;
|
|
1708
|
-
this.localTransform = undefined;
|
|
1678
|
+
this.removeAllListeners();
|
|
1709
1679
|
|
|
1710
|
-
this.
|
|
1711
|
-
this.
|
|
1680
|
+
this.destroyed = true;
|
|
1681
|
+
this.unloadTexture();
|
|
1682
|
+
this.isRenderable = false;
|
|
1712
1683
|
|
|
1684
|
+
// Kill children
|
|
1713
1685
|
while (this.children.length > 0) {
|
|
1714
|
-
this.children[0]
|
|
1686
|
+
this.children[0]!.destroy();
|
|
1715
1687
|
}
|
|
1716
1688
|
|
|
1717
|
-
|
|
1718
|
-
|
|
1689
|
+
const parent = this.parent;
|
|
1690
|
+
if (parent !== null) {
|
|
1691
|
+
const index = parent.children.indexOf(this);
|
|
1692
|
+
parent.children.splice(index, 1);
|
|
1693
|
+
parent.setUpdateType(
|
|
1694
|
+
UpdateType.Children | UpdateType.ZIndexSortedChildren,
|
|
1695
|
+
);
|
|
1696
|
+
}
|
|
1719
1697
|
|
|
1720
|
-
|
|
1698
|
+
this.props.parent = null;
|
|
1699
|
+
this.props.texture = null;
|
|
1700
|
+
|
|
1701
|
+
if (this.rtt === true) {
|
|
1721
1702
|
this.stage.renderer.removeRTTNode(this);
|
|
1722
1703
|
}
|
|
1723
|
-
|
|
1724
|
-
this.removeAllListeners();
|
|
1725
1704
|
}
|
|
1726
1705
|
|
|
1727
1706
|
renderQuads(renderer: CoreRenderer): void {
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
if (!renderer.renderToTextureActive) {
|
|
1732
|
-
return;
|
|
1733
|
-
}
|
|
1734
|
-
// Prevent quad rendering if parent render texture is not the active render texture
|
|
1735
|
-
if (this.parentRenderTexture !== renderer.activeRttNode) {
|
|
1707
|
+
if (this.parentHasRenderTexture === true) {
|
|
1708
|
+
const rtt = renderer.renderToTextureActive;
|
|
1709
|
+
if (rtt === false || this.parentRenderTexture !== renderer.activeRttNode)
|
|
1736
1710
|
return;
|
|
1737
|
-
}
|
|
1738
1711
|
}
|
|
1739
1712
|
|
|
1740
|
-
|
|
1713
|
+
const p = this.props;
|
|
1714
|
+
const t = this.globalTransform!;
|
|
1715
|
+
const coords = this.renderCoords;
|
|
1716
|
+
const texture = p.texture || this.stage.defaultTexture;
|
|
1741
1717
|
|
|
1742
|
-
// add to list of renderables to be sorted before rendering
|
|
1743
1718
|
renderer.addQuad({
|
|
1744
|
-
width:
|
|
1745
|
-
height:
|
|
1719
|
+
width: p.width,
|
|
1720
|
+
height: p.height,
|
|
1746
1721
|
colorTl: this.premultipliedColorTl,
|
|
1747
1722
|
colorTr: this.premultipliedColorTr,
|
|
1748
1723
|
colorBl: this.premultipliedColorBl,
|
|
1749
1724
|
colorBr: this.premultipliedColorBr,
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
texture: this.texture || this.stage.defaultTexture,
|
|
1753
|
-
textureOptions: this.textureOptions,
|
|
1725
|
+
texture,
|
|
1726
|
+
textureOptions: p.textureOptions,
|
|
1754
1727
|
textureCoords: this.textureCoords,
|
|
1755
|
-
|
|
1756
|
-
shader: this.props.shader as CoreShaderNode<any>,
|
|
1728
|
+
shader: p.shader as CoreShaderNode<any>,
|
|
1757
1729
|
alpha: this.worldAlpha,
|
|
1758
1730
|
clippingRect: this.clippingRect,
|
|
1759
|
-
tx:
|
|
1760
|
-
ty:
|
|
1761
|
-
ta:
|
|
1762
|
-
tb:
|
|
1763
|
-
tc:
|
|
1764
|
-
td:
|
|
1765
|
-
renderCoords:
|
|
1766
|
-
rtt:
|
|
1731
|
+
tx: t.tx,
|
|
1732
|
+
ty: t.ty,
|
|
1733
|
+
ta: t.ta,
|
|
1734
|
+
tb: t.tb,
|
|
1735
|
+
tc: t.tc,
|
|
1736
|
+
td: t.td,
|
|
1737
|
+
renderCoords: coords,
|
|
1738
|
+
rtt: p.rtt,
|
|
1739
|
+
zIndex: this.calcZIndex,
|
|
1767
1740
|
parentHasRenderTexture: this.parentHasRenderTexture,
|
|
1768
|
-
framebufferDimensions:
|
|
1769
|
-
this.
|
|
1770
|
-
|
|
1771
|
-
: null,
|
|
1741
|
+
framebufferDimensions: this.parentHasRenderTexture
|
|
1742
|
+
? this.parentFramebufferDimensions
|
|
1743
|
+
: null,
|
|
1772
1744
|
});
|
|
1773
1745
|
}
|
|
1774
1746
|
|
|
@@ -1887,7 +1859,7 @@ export class CoreNode extends EventEmitter {
|
|
|
1887
1859
|
set scaleX(value: number) {
|
|
1888
1860
|
if (this.props.scaleX !== value) {
|
|
1889
1861
|
this.props.scaleX = value;
|
|
1890
|
-
this.setUpdateType(UpdateType.
|
|
1862
|
+
this.setUpdateType(UpdateType.Local);
|
|
1891
1863
|
}
|
|
1892
1864
|
}
|
|
1893
1865
|
|
|
@@ -1898,7 +1870,7 @@ export class CoreNode extends EventEmitter {
|
|
|
1898
1870
|
set scaleY(value: number) {
|
|
1899
1871
|
if (this.props.scaleY !== value) {
|
|
1900
1872
|
this.props.scaleY = value;
|
|
1901
|
-
this.setUpdateType(UpdateType.
|
|
1873
|
+
this.setUpdateType(UpdateType.Local);
|
|
1902
1874
|
}
|
|
1903
1875
|
}
|
|
1904
1876
|
|
|
@@ -1979,7 +1951,7 @@ export class CoreNode extends EventEmitter {
|
|
|
1979
1951
|
set rotation(value: number) {
|
|
1980
1952
|
if (this.props.rotation !== value) {
|
|
1981
1953
|
this.props.rotation = value;
|
|
1982
|
-
this.setUpdateType(UpdateType.
|
|
1954
|
+
this.setUpdateType(UpdateType.Local);
|
|
1983
1955
|
}
|
|
1984
1956
|
}
|
|
1985
1957
|
|
|
@@ -2007,11 +1979,20 @@ export class CoreNode extends EventEmitter {
|
|
|
2007
1979
|
}
|
|
2008
1980
|
|
|
2009
1981
|
get boundsMargin(): number | [number, number, number, number] | null {
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
1982
|
+
const props = this.props;
|
|
1983
|
+
if (props.boundsMargin !== null) {
|
|
1984
|
+
return props.boundsMargin;
|
|
1985
|
+
}
|
|
1986
|
+
|
|
1987
|
+
const parent = this.parent;
|
|
1988
|
+
if (parent !== null) {
|
|
1989
|
+
const margin = parent.boundsMargin;
|
|
1990
|
+
if (margin !== undefined) {
|
|
1991
|
+
return margin;
|
|
1992
|
+
}
|
|
1993
|
+
}
|
|
1994
|
+
|
|
1995
|
+
return this.stage.boundsMargin;
|
|
2015
1996
|
}
|
|
2016
1997
|
|
|
2017
1998
|
set boundsMargin(value: number | [number, number, number, number] | null) {
|
|
@@ -2048,11 +2029,18 @@ export class CoreNode extends EventEmitter {
|
|
|
2048
2029
|
}
|
|
2049
2030
|
|
|
2050
2031
|
set color(value: number) {
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2032
|
+
const p = this.props;
|
|
2033
|
+
if (p.color === value) return;
|
|
2034
|
+
|
|
2035
|
+
p.color = value;
|
|
2036
|
+
|
|
2037
|
+
const has = value > 0;
|
|
2038
|
+
this.hasColorProps = has;
|
|
2039
|
+
|
|
2040
|
+
if (p.colorTop !== value) this.colorTop = value;
|
|
2041
|
+
if (p.colorBottom !== value) this.colorBottom = value;
|
|
2042
|
+
if (p.colorLeft !== value) this.colorLeft = value;
|
|
2043
|
+
if (p.colorRight !== value) this.colorRight = value;
|
|
2056
2044
|
|
|
2057
2045
|
this.setUpdateType(UpdateType.PremultipliedColors);
|
|
2058
2046
|
}
|
|
@@ -2067,6 +2055,7 @@ export class CoreNode extends EventEmitter {
|
|
|
2067
2055
|
this.colorTr = value;
|
|
2068
2056
|
}
|
|
2069
2057
|
this.props.colorTop = value;
|
|
2058
|
+
this.hasColorProps = value > 0;
|
|
2070
2059
|
this.setUpdateType(UpdateType.PremultipliedColors);
|
|
2071
2060
|
}
|
|
2072
2061
|
|
|
@@ -2080,6 +2069,7 @@ export class CoreNode extends EventEmitter {
|
|
|
2080
2069
|
this.colorBr = value;
|
|
2081
2070
|
}
|
|
2082
2071
|
this.props.colorBottom = value;
|
|
2072
|
+
this.hasColorProps = value > 0;
|
|
2083
2073
|
this.setUpdateType(UpdateType.PremultipliedColors);
|
|
2084
2074
|
}
|
|
2085
2075
|
|
|
@@ -2093,6 +2083,7 @@ export class CoreNode extends EventEmitter {
|
|
|
2093
2083
|
this.colorBl = value;
|
|
2094
2084
|
}
|
|
2095
2085
|
this.props.colorLeft = value;
|
|
2086
|
+
this.hasColorProps = value > 0;
|
|
2096
2087
|
this.setUpdateType(UpdateType.PremultipliedColors);
|
|
2097
2088
|
}
|
|
2098
2089
|
|
|
@@ -2106,6 +2097,7 @@ export class CoreNode extends EventEmitter {
|
|
|
2106
2097
|
this.colorBr = value;
|
|
2107
2098
|
}
|
|
2108
2099
|
this.props.colorRight = value;
|
|
2100
|
+
this.hasColorProps = value > 0;
|
|
2109
2101
|
this.setUpdateType(UpdateType.PremultipliedColors);
|
|
2110
2102
|
}
|
|
2111
2103
|
|
|
@@ -2115,6 +2107,7 @@ export class CoreNode extends EventEmitter {
|
|
|
2115
2107
|
|
|
2116
2108
|
set colorTl(value: number) {
|
|
2117
2109
|
this.props.colorTl = value;
|
|
2110
|
+
this.hasColorProps = value > 0;
|
|
2118
2111
|
this.setUpdateType(UpdateType.PremultipliedColors);
|
|
2119
2112
|
}
|
|
2120
2113
|
|
|
@@ -2124,6 +2117,7 @@ export class CoreNode extends EventEmitter {
|
|
|
2124
2117
|
|
|
2125
2118
|
set colorTr(value: number) {
|
|
2126
2119
|
this.props.colorTr = value;
|
|
2120
|
+
this.hasColorProps = value > 0;
|
|
2127
2121
|
this.setUpdateType(UpdateType.PremultipliedColors);
|
|
2128
2122
|
}
|
|
2129
2123
|
|
|
@@ -2133,6 +2127,7 @@ export class CoreNode extends EventEmitter {
|
|
|
2133
2127
|
|
|
2134
2128
|
set colorBl(value: number) {
|
|
2135
2129
|
this.props.colorBl = value;
|
|
2130
|
+
this.hasColorProps = value > 0;
|
|
2136
2131
|
this.setUpdateType(UpdateType.PremultipliedColors);
|
|
2137
2132
|
}
|
|
2138
2133
|
|
|
@@ -2142,6 +2137,7 @@ export class CoreNode extends EventEmitter {
|
|
|
2142
2137
|
|
|
2143
2138
|
set colorBr(value: number) {
|
|
2144
2139
|
this.props.colorBr = value;
|
|
2140
|
+
this.hasColorProps = value > 0;
|
|
2145
2141
|
this.setUpdateType(UpdateType.PremultipliedColors);
|
|
2146
2142
|
}
|
|
2147
2143
|
|
|
@@ -2202,7 +2198,6 @@ export class CoreNode extends EventEmitter {
|
|
|
2202
2198
|
this.applyRTTInheritance(newParent);
|
|
2203
2199
|
}
|
|
2204
2200
|
}
|
|
2205
|
-
this.updateScaleRotateTransform();
|
|
2206
2201
|
|
|
2207
2202
|
// fetch render bounds from parent
|
|
2208
2203
|
this.setUpdateType(UpdateType.RenderBounds | UpdateType.Children);
|
|
@@ -2420,7 +2415,6 @@ export class CoreNode extends EventEmitter {
|
|
|
2420
2415
|
|
|
2421
2416
|
const oldTexture = this.props.texture;
|
|
2422
2417
|
if (oldTexture) {
|
|
2423
|
-
oldTexture.setRenderableOwner(this, false);
|
|
2424
2418
|
this.unloadTexture();
|
|
2425
2419
|
}
|
|
2426
2420
|
|