@lightningjs/renderer 3.0.0-beta7 → 3.0.0-beta8
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 +251 -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.js +5 -4
- 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 +9 -0
- package/dist/src/core/TextureMemoryManager.js +78 -48
- 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 +7 -1
- package/dist/src/core/animations/CoreAnimationController.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/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 +8 -0
- package/dist/src/core/textures/Texture.js +13 -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 +301 -313
- package/src/core/CoreTextNode.ts +23 -20
- package/src/core/CoreTextureManager.ts +5 -4
- package/src/core/Stage.ts +68 -65
- package/src/core/TextureMemoryManager.ts +104 -63
- package/src/core/animations/CoreAnimation.ts +7 -0
- package/src/core/animations/CoreAnimationController.ts +8 -1
- 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/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 +14 -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) {
|
|
@@ -944,46 +964,30 @@ export class CoreNode extends EventEmitter {
|
|
|
944
964
|
const parent = this.props.parent;
|
|
945
965
|
if (!parent) return;
|
|
946
966
|
|
|
947
|
-
|
|
948
|
-
// Inform the parent if it doesn’t already have a child update
|
|
949
|
-
parent.setUpdateType(UpdateType.Children);
|
|
950
|
-
}
|
|
967
|
+
parent.setUpdateType(UpdateType.Children);
|
|
951
968
|
}
|
|
952
969
|
|
|
953
970
|
sortChildren() {
|
|
954
971
|
this.children.sort((a, b) => a.calcZIndex - b.calcZIndex);
|
|
955
972
|
}
|
|
956
973
|
|
|
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
974
|
updateLocalTransform() {
|
|
973
|
-
const
|
|
974
|
-
const
|
|
975
|
-
const
|
|
975
|
+
const p = this.props;
|
|
976
|
+
const { x, y, width, height } = p;
|
|
977
|
+
const mountTranslateX = p.mountX * width;
|
|
978
|
+
const mountTranslateY = p.mountY * height;
|
|
976
979
|
|
|
977
|
-
if (
|
|
978
|
-
const pivotTranslateX =
|
|
979
|
-
const pivotTranslateY =
|
|
980
|
+
if (p.rotation !== 0 || p.scaleX !== 1 || p.scaleY !== 1) {
|
|
981
|
+
const pivotTranslateX = p.pivotX * width;
|
|
982
|
+
const pivotTranslateY = p.pivotY * height;
|
|
980
983
|
|
|
981
984
|
this.localTransform = Matrix3d.translate(
|
|
982
985
|
x - mountTranslateX + pivotTranslateX,
|
|
983
986
|
y - mountTranslateY + pivotTranslateY,
|
|
984
987
|
this.localTransform,
|
|
985
988
|
)
|
|
986
|
-
.
|
|
989
|
+
.rotate(p.rotation)
|
|
990
|
+
.scale(p.scaleX, p.scaleY)
|
|
987
991
|
.translate(-pivotTranslateX, -pivotTranslateY);
|
|
988
992
|
} else {
|
|
989
993
|
this.localTransform = Matrix3d.translate(
|
|
@@ -994,11 +998,11 @@ export class CoreNode extends EventEmitter {
|
|
|
994
998
|
}
|
|
995
999
|
|
|
996
1000
|
// Handle 'contain' resize mode
|
|
997
|
-
const texture =
|
|
1001
|
+
const texture = p.texture;
|
|
998
1002
|
if (
|
|
999
1003
|
texture &&
|
|
1000
1004
|
texture.dimensions &&
|
|
1001
|
-
|
|
1005
|
+
p.textureOptions.resizeMode?.type === 'contain'
|
|
1002
1006
|
) {
|
|
1003
1007
|
let resizeModeScaleX = 1;
|
|
1004
1008
|
let resizeModeScaleY = 1;
|
|
@@ -1030,8 +1034,6 @@ export class CoreNode extends EventEmitter {
|
|
|
1030
1034
|
.translate(extraX, extraY)
|
|
1031
1035
|
.scale(resizeModeScaleX, resizeModeScaleY);
|
|
1032
1036
|
}
|
|
1033
|
-
|
|
1034
|
-
this.setUpdateType(UpdateType.Global);
|
|
1035
1037
|
}
|
|
1036
1038
|
|
|
1037
1039
|
/**
|
|
@@ -1039,27 +1041,34 @@ export class CoreNode extends EventEmitter {
|
|
|
1039
1041
|
* @param delta
|
|
1040
1042
|
*/
|
|
1041
1043
|
update(delta: number, parentClippingRect: RectWithValid): void {
|
|
1042
|
-
if (this.updateType
|
|
1043
|
-
|
|
1044
|
-
this.setUpdateType(UpdateType.Local);
|
|
1044
|
+
if (this.updateType === UpdateType.None) {
|
|
1045
|
+
return;
|
|
1045
1046
|
}
|
|
1046
1047
|
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1048
|
+
const props = this.props;
|
|
1049
|
+
const parent = props.parent;
|
|
1050
|
+
const parentHasRenderTexture = this.parentHasRenderTexture;
|
|
1051
|
+
const hasParent = props.parent !== null;
|
|
1051
1052
|
|
|
1052
|
-
const parent = this.props.parent;
|
|
1053
1053
|
let renderState: CoreNodeRenderState | null = null;
|
|
1054
1054
|
|
|
1055
|
+
let updateType = this.updateType;
|
|
1056
|
+
let childUpdateType = this.childUpdateType;
|
|
1057
|
+
let updateParent = false;
|
|
1058
|
+
|
|
1059
|
+
if (updateType & UpdateType.Local) {
|
|
1060
|
+
this.updateLocalTransform();
|
|
1061
|
+
|
|
1062
|
+
updateType |= UpdateType.Global;
|
|
1063
|
+
updateParent = hasParent;
|
|
1064
|
+
}
|
|
1065
|
+
|
|
1055
1066
|
// Handle specific RTT updates at this node level
|
|
1056
|
-
if (
|
|
1067
|
+
if (updateType & UpdateType.RenderTexture && this.rtt === true) {
|
|
1057
1068
|
this.hasRTTupdates = true;
|
|
1058
1069
|
}
|
|
1059
1070
|
|
|
1060
|
-
if (
|
|
1061
|
-
assertTruthy(this.localTransform);
|
|
1062
|
-
|
|
1071
|
+
if (updateType & UpdateType.Global) {
|
|
1063
1072
|
if (this.parentHasRenderTexture === true && parent?.rtt === true) {
|
|
1064
1073
|
// we are at the start of the RTT chain, so we need to reset the globalTransform
|
|
1065
1074
|
// for correct RTT rendering
|
|
@@ -1068,7 +1077,7 @@ export class CoreNode extends EventEmitter {
|
|
|
1068
1077
|
// Maintain a full scene global transform for bounds detection
|
|
1069
1078
|
this.sceneGlobalTransform = Matrix3d.copy(
|
|
1070
1079
|
parent?.globalTransform || Matrix3d.identity(),
|
|
1071
|
-
).multiply(this.localTransform);
|
|
1080
|
+
).multiply(this.localTransform!);
|
|
1072
1081
|
} else if (
|
|
1073
1082
|
this.parentHasRenderTexture === true &&
|
|
1074
1083
|
parent?.rtt === false
|
|
@@ -1077,50 +1086,53 @@ export class CoreNode extends EventEmitter {
|
|
|
1077
1086
|
// so we need to propogate the sceneGlobalTransform of the parent
|
|
1078
1087
|
// to maintain a full scene global transform for bounds detection
|
|
1079
1088
|
this.sceneGlobalTransform = Matrix3d.copy(
|
|
1080
|
-
parent?.sceneGlobalTransform || this.localTransform
|
|
1081
|
-
).multiply(this.localTransform);
|
|
1089
|
+
parent?.sceneGlobalTransform || this.localTransform!,
|
|
1090
|
+
).multiply(this.localTransform!);
|
|
1082
1091
|
|
|
1083
1092
|
this.globalTransform = Matrix3d.copy(
|
|
1084
|
-
parent?.globalTransform || this.localTransform
|
|
1093
|
+
parent?.globalTransform || this.localTransform!,
|
|
1085
1094
|
this.globalTransform,
|
|
1086
1095
|
);
|
|
1087
1096
|
} else {
|
|
1088
1097
|
this.globalTransform = Matrix3d.copy(
|
|
1089
|
-
parent?.globalTransform || this.localTransform
|
|
1098
|
+
parent?.globalTransform || this.localTransform!,
|
|
1090
1099
|
this.globalTransform,
|
|
1091
1100
|
);
|
|
1092
1101
|
}
|
|
1093
1102
|
|
|
1094
1103
|
if (parent !== null) {
|
|
1095
|
-
this.globalTransform.multiply(this.localTransform);
|
|
1104
|
+
this.globalTransform.multiply(this.localTransform!);
|
|
1096
1105
|
}
|
|
1097
1106
|
this.calculateRenderCoords();
|
|
1098
1107
|
this.updateBoundingRect();
|
|
1099
1108
|
|
|
1100
|
-
|
|
1109
|
+
updateType |=
|
|
1101
1110
|
UpdateType.RenderState |
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1111
|
+
UpdateType.Children |
|
|
1112
|
+
UpdateType.RecalcUniforms;
|
|
1113
|
+
updateParent = hasParent;
|
|
1114
|
+
childUpdateType |= UpdateType.Global;
|
|
1106
1115
|
|
|
1107
1116
|
if (this.clipping === true) {
|
|
1108
|
-
|
|
1109
|
-
|
|
1117
|
+
updateType |= UpdateType.Clipping | UpdateType.RenderBounds;
|
|
1118
|
+
updateParent = hasParent;
|
|
1119
|
+
childUpdateType |= UpdateType.RenderBounds;
|
|
1110
1120
|
}
|
|
1111
1121
|
}
|
|
1112
1122
|
|
|
1113
|
-
if (
|
|
1123
|
+
if (updateType & UpdateType.RenderBounds) {
|
|
1114
1124
|
this.createRenderBounds();
|
|
1115
|
-
this.setUpdateType(UpdateType.RenderState);
|
|
1116
|
-
this.setUpdateType(UpdateType.Children);
|
|
1117
1125
|
|
|
1118
|
-
|
|
1126
|
+
updateType |= UpdateType.RenderState | UpdateType.Children;
|
|
1127
|
+
updateParent = hasParent;
|
|
1128
|
+
childUpdateType |= UpdateType.RenderBounds;
|
|
1119
1129
|
}
|
|
1120
1130
|
|
|
1121
|
-
if (
|
|
1131
|
+
if (updateType & UpdateType.RenderState) {
|
|
1122
1132
|
renderState = this.checkRenderBounds();
|
|
1123
|
-
|
|
1133
|
+
|
|
1134
|
+
updateType |= UpdateType.IsRenderable;
|
|
1135
|
+
updateParent = hasParent;
|
|
1124
1136
|
|
|
1125
1137
|
// if we're not going out of bounds, update the render state
|
|
1126
1138
|
// this is done so the update loop can finish before we mark a node
|
|
@@ -1130,96 +1142,98 @@ export class CoreNode extends EventEmitter {
|
|
|
1130
1142
|
}
|
|
1131
1143
|
}
|
|
1132
1144
|
|
|
1133
|
-
if (
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
this.worldAlpha = this.props.alpha;
|
|
1138
|
-
}
|
|
1139
|
-
this.setUpdateType(
|
|
1145
|
+
if (updateType & UpdateType.WorldAlpha) {
|
|
1146
|
+
this.worldAlpha = ((parent && parent.worldAlpha) || 1) * props.alpha;
|
|
1147
|
+
updateType |=
|
|
1148
|
+
UpdateType.PremultipliedColors |
|
|
1140
1149
|
UpdateType.Children |
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
this.childUpdateType |= UpdateType.WorldAlpha;
|
|
1150
|
+
UpdateType.IsRenderable;
|
|
1151
|
+
updateParent = hasParent;
|
|
1152
|
+
childUpdateType |= UpdateType.WorldAlpha;
|
|
1145
1153
|
}
|
|
1146
1154
|
|
|
1147
|
-
if (
|
|
1155
|
+
if (updateType & UpdateType.IsRenderable) {
|
|
1148
1156
|
this.updateIsRenderable();
|
|
1149
1157
|
}
|
|
1150
1158
|
|
|
1151
|
-
if (
|
|
1159
|
+
if (updateType & UpdateType.Clipping) {
|
|
1152
1160
|
this.calculateClippingRect(parentClippingRect);
|
|
1153
|
-
|
|
1161
|
+
updateType |= UpdateType.Children;
|
|
1162
|
+
updateParent = hasParent;
|
|
1154
1163
|
|
|
1155
|
-
|
|
1156
|
-
this.childUpdateType |= UpdateType.RenderBounds;
|
|
1164
|
+
childUpdateType |= UpdateType.Clipping | UpdateType.RenderBounds;
|
|
1157
1165
|
}
|
|
1158
1166
|
|
|
1159
|
-
if (
|
|
1160
|
-
|
|
1161
|
-
this.props.colorTl,
|
|
1162
|
-
this.worldAlpha,
|
|
1163
|
-
true,
|
|
1164
|
-
);
|
|
1167
|
+
if (updateType & UpdateType.PremultipliedColors) {
|
|
1168
|
+
const alpha = this.worldAlpha;
|
|
1165
1169
|
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
)
|
|
1170
|
+
const tl = props.colorTl;
|
|
1171
|
+
const tr = props.colorTr;
|
|
1172
|
+
const bl = props.colorBl;
|
|
1173
|
+
const br = props.colorBr;
|
|
1174
|
+
|
|
1175
|
+
// Fast equality check (covers all 4 corners)
|
|
1176
|
+
const same = tl === tr && tl === bl && tl === br;
|
|
1177
|
+
|
|
1178
|
+
const merged = mergeColorAlphaPremultiplied(tl, alpha, true);
|
|
1179
|
+
|
|
1180
|
+
this.premultipliedColorTl = merged;
|
|
1181
|
+
|
|
1182
|
+
if (same) {
|
|
1172
1183
|
this.premultipliedColorTr =
|
|
1173
1184
|
this.premultipliedColorBl =
|
|
1174
1185
|
this.premultipliedColorBr =
|
|
1175
|
-
|
|
1186
|
+
merged;
|
|
1176
1187
|
} else {
|
|
1177
1188
|
this.premultipliedColorTr = mergeColorAlphaPremultiplied(
|
|
1178
|
-
|
|
1179
|
-
|
|
1189
|
+
tr,
|
|
1190
|
+
alpha,
|
|
1180
1191
|
true,
|
|
1181
1192
|
);
|
|
1182
1193
|
this.premultipliedColorBl = mergeColorAlphaPremultiplied(
|
|
1183
|
-
|
|
1184
|
-
|
|
1194
|
+
bl,
|
|
1195
|
+
alpha,
|
|
1185
1196
|
true,
|
|
1186
1197
|
);
|
|
1187
1198
|
this.premultipliedColorBr = mergeColorAlphaPremultiplied(
|
|
1188
|
-
|
|
1189
|
-
|
|
1199
|
+
br,
|
|
1200
|
+
alpha,
|
|
1190
1201
|
true,
|
|
1191
1202
|
);
|
|
1192
1203
|
}
|
|
1193
1204
|
}
|
|
1194
1205
|
|
|
1206
|
+
if (updateParent === true) {
|
|
1207
|
+
parent!.setUpdateType(UpdateType.Children);
|
|
1208
|
+
}
|
|
1195
1209
|
// No need to update zIndex if there is no parent
|
|
1196
|
-
if (
|
|
1210
|
+
if (updateType & UpdateType.CalculatedZIndex && parent !== null) {
|
|
1197
1211
|
this.calculateZIndex();
|
|
1198
1212
|
// Tell parent to re-sort children
|
|
1199
1213
|
parent.setUpdateType(UpdateType.ZIndexSortedChildren);
|
|
1200
1214
|
}
|
|
1201
1215
|
|
|
1202
1216
|
if (
|
|
1203
|
-
|
|
1217
|
+
props.strictBounds === true &&
|
|
1204
1218
|
this.renderState === CoreNodeRenderState.OutOfBounds
|
|
1205
1219
|
) {
|
|
1206
|
-
|
|
1220
|
+
updateType &= ~UpdateType.RenderBounds; // remove render bounds update
|
|
1207
1221
|
return;
|
|
1208
1222
|
}
|
|
1209
1223
|
|
|
1210
1224
|
if (
|
|
1211
|
-
|
|
1225
|
+
updateType & UpdateType.RecalcUniforms &&
|
|
1212
1226
|
this.hasShaderUpdater === true
|
|
1213
1227
|
) {
|
|
1214
1228
|
//this exists because the boolean hasShaderUpdater === true
|
|
1215
1229
|
this.shader!.update!();
|
|
1216
1230
|
}
|
|
1217
1231
|
|
|
1218
|
-
if (
|
|
1232
|
+
if (updateType & UpdateType.Children && this.children.length > 0) {
|
|
1219
1233
|
for (let i = 0, length = this.children.length; i < length; i++) {
|
|
1220
1234
|
const child = this.children[i] as CoreNode;
|
|
1221
1235
|
|
|
1222
|
-
child.setUpdateType(
|
|
1236
|
+
child.setUpdateType(childUpdateType);
|
|
1223
1237
|
|
|
1224
1238
|
if (child.updateType === 0) {
|
|
1225
1239
|
continue;
|
|
@@ -1241,15 +1255,15 @@ export class CoreNode extends EventEmitter {
|
|
|
1241
1255
|
}
|
|
1242
1256
|
|
|
1243
1257
|
// If the node has an RTT parent and requires a texture re-render, inform the RTT parent
|
|
1244
|
-
// if (this.parentHasRenderTexture &&
|
|
1258
|
+
// if (this.parentHasRenderTexture && updateType & UpdateType.RenderTexture) {
|
|
1245
1259
|
// @TODO have a more scoped down updateType for RTT updates
|
|
1246
|
-
if (
|
|
1260
|
+
if (parentHasRenderTexture === true) {
|
|
1247
1261
|
this.notifyParentRTTOfUpdate();
|
|
1248
1262
|
}
|
|
1249
1263
|
|
|
1250
1264
|
// Sorting children MUST happen after children have been updated so
|
|
1251
1265
|
// that they have the oppotunity to update their calculated zIndex.
|
|
1252
|
-
if (
|
|
1266
|
+
if (updateType & UpdateType.ZIndexSortedChildren) {
|
|
1253
1267
|
// reorder z-index
|
|
1254
1268
|
this.sortChildren();
|
|
1255
1269
|
}
|
|
@@ -1273,7 +1287,6 @@ export class CoreNode extends EventEmitter {
|
|
|
1273
1287
|
// notify children that we are going out of bounds
|
|
1274
1288
|
// we have to do this now before we stop processing the render tree
|
|
1275
1289
|
this.notifyChildrenRTTOfUpdate(renderState);
|
|
1276
|
-
// this.childUpdateType |= UpdateType.RenderState;
|
|
1277
1290
|
}
|
|
1278
1291
|
}
|
|
1279
1292
|
|
|
@@ -1320,20 +1333,16 @@ export class CoreNode extends EventEmitter {
|
|
|
1320
1333
|
}
|
|
1321
1334
|
|
|
1322
1335
|
checkRenderBounds(): CoreNodeRenderState {
|
|
1323
|
-
|
|
1324
|
-
assertTruthy(this.strictBound);
|
|
1325
|
-
assertTruthy(this.preloadBound);
|
|
1326
|
-
|
|
1327
|
-
if (boundInsideBound(this.renderBound, this.strictBound)) {
|
|
1336
|
+
if (boundInsideBound(this.renderBound!, this.strictBound!)) {
|
|
1328
1337
|
return CoreNodeRenderState.InViewport;
|
|
1329
1338
|
}
|
|
1330
1339
|
|
|
1331
|
-
if (boundInsideBound(this.renderBound
|
|
1340
|
+
if (boundInsideBound(this.renderBound!, this.preloadBound!)) {
|
|
1332
1341
|
return CoreNodeRenderState.InBounds;
|
|
1333
1342
|
}
|
|
1334
1343
|
|
|
1335
1344
|
// check if we're larger then our parent, we're definitely in the viewport
|
|
1336
|
-
if (boundLargeThanBound(this.renderBound
|
|
1345
|
+
if (boundLargeThanBound(this.renderBound!, this.strictBound!)) {
|
|
1337
1346
|
return CoreNodeRenderState.InViewport;
|
|
1338
1347
|
}
|
|
1339
1348
|
|
|
@@ -1349,11 +1358,8 @@ export class CoreNode extends EventEmitter {
|
|
|
1349
1358
|
}
|
|
1350
1359
|
|
|
1351
1360
|
updateBoundingRect() {
|
|
1352
|
-
const transform = this.sceneGlobalTransform || this.globalTransform
|
|
1353
|
-
const renderCoords = this.sceneRenderCoords || this.renderCoords
|
|
1354
|
-
|
|
1355
|
-
assertTruthy(transform);
|
|
1356
|
-
assertTruthy(renderCoords);
|
|
1361
|
+
const transform = (this.sceneGlobalTransform || this.globalTransform)!;
|
|
1362
|
+
const renderCoords = (this.sceneRenderCoords || this.renderCoords)!;
|
|
1357
1363
|
|
|
1358
1364
|
if (transform.tb === 0 || transform.tc === 0) {
|
|
1359
1365
|
this.renderBound = createBound(
|
|
@@ -1457,7 +1463,10 @@ export class CoreNode extends EventEmitter {
|
|
|
1457
1463
|
let needsTextureOwnership = false;
|
|
1458
1464
|
|
|
1459
1465
|
// If the node is out of bounds or has an alpha of 0, it is not renderable
|
|
1460
|
-
if (
|
|
1466
|
+
if (
|
|
1467
|
+
this.worldAlpha === 0 ||
|
|
1468
|
+
this.renderState <= CoreNodeRenderState.OutOfBounds
|
|
1469
|
+
) {
|
|
1461
1470
|
this.updateTextureOwnership(false);
|
|
1462
1471
|
this.setRenderable(false);
|
|
1463
1472
|
return;
|
|
@@ -1469,8 +1478,10 @@ export class CoreNode extends EventEmitter {
|
|
|
1469
1478
|
// we're only renderable if the texture state is loaded
|
|
1470
1479
|
newIsRenderable = this.texture.state === 'loaded';
|
|
1471
1480
|
} else if (
|
|
1472
|
-
|
|
1473
|
-
this.
|
|
1481
|
+
// check shader
|
|
1482
|
+
(this.props.shader !== null || this.hasColorProps === true) &&
|
|
1483
|
+
// check dimensions
|
|
1484
|
+
(this.props.width !== 0 && this.props.height !== 0) === true
|
|
1474
1485
|
) {
|
|
1475
1486
|
// This mean we have dimensions and a color set, so we can render a ColorTexture
|
|
1476
1487
|
if (
|
|
@@ -1485,17 +1496,6 @@ export class CoreNode extends EventEmitter {
|
|
|
1485
1496
|
this.setRenderable(newIsRenderable);
|
|
1486
1497
|
}
|
|
1487
1498
|
|
|
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
1499
|
/**
|
|
1500
1500
|
* Sets the renderable state and triggers changes if necessary.
|
|
1501
1501
|
* @param isRenderable - The new renderable state
|
|
@@ -1518,44 +1518,16 @@ export class CoreNode extends EventEmitter {
|
|
|
1518
1518
|
this.texture?.setRenderableOwner(this, isRenderable);
|
|
1519
1519
|
}
|
|
1520
1520
|
|
|
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
1521
|
calculateRenderCoords() {
|
|
1557
1522
|
const { width, height } = this;
|
|
1558
|
-
|
|
1523
|
+
|
|
1524
|
+
const g = this.globalTransform!;
|
|
1525
|
+
const tx = g.tx,
|
|
1526
|
+
ty = g.ty,
|
|
1527
|
+
ta = g.ta,
|
|
1528
|
+
tb = g.tb,
|
|
1529
|
+
tc = g.tc,
|
|
1530
|
+
td = g.td;
|
|
1559
1531
|
if (tb === 0 && tc === 0) {
|
|
1560
1532
|
const minX = tx;
|
|
1561
1533
|
const maxX = tx + width * ta;
|
|
@@ -1653,16 +1625,15 @@ export class CoreNode extends EventEmitter {
|
|
|
1653
1625
|
* Finally, the node's parentClippingRect and clippingRect properties are updated.
|
|
1654
1626
|
*/
|
|
1655
1627
|
calculateClippingRect(parentClippingRect: RectWithValid) {
|
|
1656
|
-
assertTruthy(this.globalTransform);
|
|
1657
1628
|
const { clippingRect, props, globalTransform: gt } = this;
|
|
1658
1629
|
const { clipping } = props;
|
|
1659
|
-
const isRotated = gt
|
|
1630
|
+
const isRotated = gt!.tb !== 0 || gt!.tc !== 0;
|
|
1660
1631
|
|
|
1661
1632
|
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
|
|
1633
|
+
clippingRect.x = gt!.tx;
|
|
1634
|
+
clippingRect.y = gt!.ty;
|
|
1635
|
+
clippingRect.width = this.width * gt!.ta;
|
|
1636
|
+
clippingRect.height = this.height * gt!.td;
|
|
1666
1637
|
clippingRect.valid = true;
|
|
1667
1638
|
} else {
|
|
1668
1639
|
clippingRect.valid = false;
|
|
@@ -1694,81 +1665,76 @@ export class CoreNode extends EventEmitter {
|
|
|
1694
1665
|
* Destroy the node and cleanup all resources
|
|
1695
1666
|
*/
|
|
1696
1667
|
destroy(): void {
|
|
1697
|
-
this.
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
this.isRenderable = false;
|
|
1668
|
+
if (this.destroyed === true) {
|
|
1669
|
+
return;
|
|
1670
|
+
}
|
|
1701
1671
|
|
|
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;
|
|
1672
|
+
this.removeAllListeners();
|
|
1709
1673
|
|
|
1710
|
-
this.
|
|
1711
|
-
this.
|
|
1674
|
+
this.destroyed = true;
|
|
1675
|
+
this.unloadTexture();
|
|
1676
|
+
this.isRenderable = false;
|
|
1712
1677
|
|
|
1678
|
+
// Kill children
|
|
1713
1679
|
while (this.children.length > 0) {
|
|
1714
|
-
this.children[0]
|
|
1680
|
+
this.children[0]!.destroy();
|
|
1715
1681
|
}
|
|
1716
1682
|
|
|
1717
|
-
|
|
1718
|
-
|
|
1683
|
+
const parent = this.parent;
|
|
1684
|
+
if (parent !== null) {
|
|
1685
|
+
const index = parent.children.indexOf(this);
|
|
1686
|
+
parent.children.splice(index, 1);
|
|
1687
|
+
parent.setUpdateType(
|
|
1688
|
+
UpdateType.Children | UpdateType.ZIndexSortedChildren,
|
|
1689
|
+
);
|
|
1690
|
+
}
|
|
1719
1691
|
|
|
1720
|
-
|
|
1692
|
+
this.props.parent = null;
|
|
1693
|
+
this.props.texture = null;
|
|
1694
|
+
|
|
1695
|
+
if (this.rtt === true) {
|
|
1721
1696
|
this.stage.renderer.removeRTTNode(this);
|
|
1722
1697
|
}
|
|
1723
|
-
|
|
1724
|
-
this.removeAllListeners();
|
|
1725
1698
|
}
|
|
1726
1699
|
|
|
1727
1700
|
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) {
|
|
1701
|
+
if (this.parentHasRenderTexture === true) {
|
|
1702
|
+
const rtt = renderer.renderToTextureActive;
|
|
1703
|
+
if (rtt === false || this.parentRenderTexture !== renderer.activeRttNode)
|
|
1736
1704
|
return;
|
|
1737
|
-
}
|
|
1738
1705
|
}
|
|
1739
1706
|
|
|
1740
|
-
|
|
1707
|
+
const p = this.props;
|
|
1708
|
+
const t = this.globalTransform!;
|
|
1709
|
+
const coords = this.renderCoords;
|
|
1710
|
+
const texture = p.texture || this.stage.defaultTexture;
|
|
1741
1711
|
|
|
1742
|
-
// add to list of renderables to be sorted before rendering
|
|
1743
1712
|
renderer.addQuad({
|
|
1744
|
-
width:
|
|
1745
|
-
height:
|
|
1713
|
+
width: p.width,
|
|
1714
|
+
height: p.height,
|
|
1746
1715
|
colorTl: this.premultipliedColorTl,
|
|
1747
1716
|
colorTr: this.premultipliedColorTr,
|
|
1748
1717
|
colorBl: this.premultipliedColorBl,
|
|
1749
1718
|
colorBr: this.premultipliedColorBr,
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
texture: this.texture || this.stage.defaultTexture,
|
|
1753
|
-
textureOptions: this.textureOptions,
|
|
1719
|
+
texture,
|
|
1720
|
+
textureOptions: p.textureOptions,
|
|
1754
1721
|
textureCoords: this.textureCoords,
|
|
1755
|
-
|
|
1756
|
-
shader: this.props.shader as CoreShaderNode<any>,
|
|
1722
|
+
shader: p.shader as CoreShaderNode<any>,
|
|
1757
1723
|
alpha: this.worldAlpha,
|
|
1758
1724
|
clippingRect: this.clippingRect,
|
|
1759
|
-
tx:
|
|
1760
|
-
ty:
|
|
1761
|
-
ta:
|
|
1762
|
-
tb:
|
|
1763
|
-
tc:
|
|
1764
|
-
td:
|
|
1765
|
-
renderCoords:
|
|
1766
|
-
rtt:
|
|
1725
|
+
tx: t.tx,
|
|
1726
|
+
ty: t.ty,
|
|
1727
|
+
ta: t.ta,
|
|
1728
|
+
tb: t.tb,
|
|
1729
|
+
tc: t.tc,
|
|
1730
|
+
td: t.td,
|
|
1731
|
+
renderCoords: coords,
|
|
1732
|
+
rtt: p.rtt,
|
|
1733
|
+
zIndex: this.calcZIndex,
|
|
1767
1734
|
parentHasRenderTexture: this.parentHasRenderTexture,
|
|
1768
|
-
framebufferDimensions:
|
|
1769
|
-
this.
|
|
1770
|
-
|
|
1771
|
-
: null,
|
|
1735
|
+
framebufferDimensions: this.parentHasRenderTexture
|
|
1736
|
+
? this.parentFramebufferDimensions
|
|
1737
|
+
: null,
|
|
1772
1738
|
});
|
|
1773
1739
|
}
|
|
1774
1740
|
|
|
@@ -1887,7 +1853,7 @@ export class CoreNode extends EventEmitter {
|
|
|
1887
1853
|
set scaleX(value: number) {
|
|
1888
1854
|
if (this.props.scaleX !== value) {
|
|
1889
1855
|
this.props.scaleX = value;
|
|
1890
|
-
this.setUpdateType(UpdateType.
|
|
1856
|
+
this.setUpdateType(UpdateType.Local);
|
|
1891
1857
|
}
|
|
1892
1858
|
}
|
|
1893
1859
|
|
|
@@ -1898,7 +1864,7 @@ export class CoreNode extends EventEmitter {
|
|
|
1898
1864
|
set scaleY(value: number) {
|
|
1899
1865
|
if (this.props.scaleY !== value) {
|
|
1900
1866
|
this.props.scaleY = value;
|
|
1901
|
-
this.setUpdateType(UpdateType.
|
|
1867
|
+
this.setUpdateType(UpdateType.Local);
|
|
1902
1868
|
}
|
|
1903
1869
|
}
|
|
1904
1870
|
|
|
@@ -1979,7 +1945,7 @@ export class CoreNode extends EventEmitter {
|
|
|
1979
1945
|
set rotation(value: number) {
|
|
1980
1946
|
if (this.props.rotation !== value) {
|
|
1981
1947
|
this.props.rotation = value;
|
|
1982
|
-
this.setUpdateType(UpdateType.
|
|
1948
|
+
this.setUpdateType(UpdateType.Local);
|
|
1983
1949
|
}
|
|
1984
1950
|
}
|
|
1985
1951
|
|
|
@@ -2007,11 +1973,20 @@ export class CoreNode extends EventEmitter {
|
|
|
2007
1973
|
}
|
|
2008
1974
|
|
|
2009
1975
|
get boundsMargin(): number | [number, number, number, number] | null {
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
1976
|
+
const props = this.props;
|
|
1977
|
+
if (props.boundsMargin !== null) {
|
|
1978
|
+
return props.boundsMargin;
|
|
1979
|
+
}
|
|
1980
|
+
|
|
1981
|
+
const parent = this.parent;
|
|
1982
|
+
if (parent !== null) {
|
|
1983
|
+
const margin = parent.boundsMargin;
|
|
1984
|
+
if (margin !== undefined) {
|
|
1985
|
+
return margin;
|
|
1986
|
+
}
|
|
1987
|
+
}
|
|
1988
|
+
|
|
1989
|
+
return this.stage.boundsMargin;
|
|
2015
1990
|
}
|
|
2016
1991
|
|
|
2017
1992
|
set boundsMargin(value: number | [number, number, number, number] | null) {
|
|
@@ -2048,11 +2023,18 @@ export class CoreNode extends EventEmitter {
|
|
|
2048
2023
|
}
|
|
2049
2024
|
|
|
2050
2025
|
set color(value: number) {
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2026
|
+
const p = this.props;
|
|
2027
|
+
if (p.color === value) return;
|
|
2028
|
+
|
|
2029
|
+
p.color = value;
|
|
2030
|
+
|
|
2031
|
+
const has = value > 0;
|
|
2032
|
+
this.hasColorProps = has;
|
|
2033
|
+
|
|
2034
|
+
if (p.colorTop !== value) this.colorTop = value;
|
|
2035
|
+
if (p.colorBottom !== value) this.colorBottom = value;
|
|
2036
|
+
if (p.colorLeft !== value) this.colorLeft = value;
|
|
2037
|
+
if (p.colorRight !== value) this.colorRight = value;
|
|
2056
2038
|
|
|
2057
2039
|
this.setUpdateType(UpdateType.PremultipliedColors);
|
|
2058
2040
|
}
|
|
@@ -2067,6 +2049,7 @@ export class CoreNode extends EventEmitter {
|
|
|
2067
2049
|
this.colorTr = value;
|
|
2068
2050
|
}
|
|
2069
2051
|
this.props.colorTop = value;
|
|
2052
|
+
this.hasColorProps = value > 0;
|
|
2070
2053
|
this.setUpdateType(UpdateType.PremultipliedColors);
|
|
2071
2054
|
}
|
|
2072
2055
|
|
|
@@ -2080,6 +2063,7 @@ export class CoreNode extends EventEmitter {
|
|
|
2080
2063
|
this.colorBr = value;
|
|
2081
2064
|
}
|
|
2082
2065
|
this.props.colorBottom = value;
|
|
2066
|
+
this.hasColorProps = value > 0;
|
|
2083
2067
|
this.setUpdateType(UpdateType.PremultipliedColors);
|
|
2084
2068
|
}
|
|
2085
2069
|
|
|
@@ -2093,6 +2077,7 @@ export class CoreNode extends EventEmitter {
|
|
|
2093
2077
|
this.colorBl = value;
|
|
2094
2078
|
}
|
|
2095
2079
|
this.props.colorLeft = value;
|
|
2080
|
+
this.hasColorProps = value > 0;
|
|
2096
2081
|
this.setUpdateType(UpdateType.PremultipliedColors);
|
|
2097
2082
|
}
|
|
2098
2083
|
|
|
@@ -2106,6 +2091,7 @@ export class CoreNode extends EventEmitter {
|
|
|
2106
2091
|
this.colorBr = value;
|
|
2107
2092
|
}
|
|
2108
2093
|
this.props.colorRight = value;
|
|
2094
|
+
this.hasColorProps = value > 0;
|
|
2109
2095
|
this.setUpdateType(UpdateType.PremultipliedColors);
|
|
2110
2096
|
}
|
|
2111
2097
|
|
|
@@ -2115,6 +2101,7 @@ export class CoreNode extends EventEmitter {
|
|
|
2115
2101
|
|
|
2116
2102
|
set colorTl(value: number) {
|
|
2117
2103
|
this.props.colorTl = value;
|
|
2104
|
+
this.hasColorProps = value > 0;
|
|
2118
2105
|
this.setUpdateType(UpdateType.PremultipliedColors);
|
|
2119
2106
|
}
|
|
2120
2107
|
|
|
@@ -2124,6 +2111,7 @@ export class CoreNode extends EventEmitter {
|
|
|
2124
2111
|
|
|
2125
2112
|
set colorTr(value: number) {
|
|
2126
2113
|
this.props.colorTr = value;
|
|
2114
|
+
this.hasColorProps = value > 0;
|
|
2127
2115
|
this.setUpdateType(UpdateType.PremultipliedColors);
|
|
2128
2116
|
}
|
|
2129
2117
|
|
|
@@ -2133,6 +2121,7 @@ export class CoreNode extends EventEmitter {
|
|
|
2133
2121
|
|
|
2134
2122
|
set colorBl(value: number) {
|
|
2135
2123
|
this.props.colorBl = value;
|
|
2124
|
+
this.hasColorProps = value > 0;
|
|
2136
2125
|
this.setUpdateType(UpdateType.PremultipliedColors);
|
|
2137
2126
|
}
|
|
2138
2127
|
|
|
@@ -2142,6 +2131,7 @@ export class CoreNode extends EventEmitter {
|
|
|
2142
2131
|
|
|
2143
2132
|
set colorBr(value: number) {
|
|
2144
2133
|
this.props.colorBr = value;
|
|
2134
|
+
this.hasColorProps = value > 0;
|
|
2145
2135
|
this.setUpdateType(UpdateType.PremultipliedColors);
|
|
2146
2136
|
}
|
|
2147
2137
|
|
|
@@ -2202,7 +2192,6 @@ export class CoreNode extends EventEmitter {
|
|
|
2202
2192
|
this.applyRTTInheritance(newParent);
|
|
2203
2193
|
}
|
|
2204
2194
|
}
|
|
2205
|
-
this.updateScaleRotateTransform();
|
|
2206
2195
|
|
|
2207
2196
|
// fetch render bounds from parent
|
|
2208
2197
|
this.setUpdateType(UpdateType.RenderBounds | UpdateType.Children);
|
|
@@ -2420,7 +2409,6 @@ export class CoreNode extends EventEmitter {
|
|
|
2420
2409
|
|
|
2421
2410
|
const oldTexture = this.props.texture;
|
|
2422
2411
|
if (oldTexture) {
|
|
2423
|
-
oldTexture.setRenderableOwner(this, false);
|
|
2424
2412
|
this.unloadTexture();
|
|
2425
2413
|
}
|
|
2426
2414
|
|