@lightningjs/renderer 2.18.3 → 2.19.0
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/canvas-shaders.d.ts +10 -0
- package/dist/exports/canvas-shaders.js +27 -0
- package/dist/exports/canvas-shaders.js.map +1 -0
- package/dist/exports/index.d.ts +1 -0
- package/dist/exports/index.js +1 -0
- package/dist/exports/index.js.map +1 -1
- package/dist/exports/webgl-shaders.d.ts +11 -0
- package/dist/exports/webgl-shaders.js +28 -0
- package/dist/exports/webgl-shaders.js.map +1 -0
- package/dist/src/common/CommonTypes.d.ts +2 -1
- package/dist/src/core/CoreTextureManager.d.ts +2 -0
- package/dist/src/core/CoreTextureManager.js +8 -4
- package/dist/src/core/CoreTextureManager.js.map +1 -1
- package/dist/src/core/Stage.d.ts +1 -0
- package/dist/src/core/Stage.js +2 -1
- package/dist/src/core/Stage.js.map +1 -1
- package/dist/src/core/TextureError.d.ts +11 -0
- package/dist/src/core/TextureError.js +37 -0
- package/dist/src/core/TextureError.js.map +1 -0
- package/dist/src/core/TextureMemoryManager.d.ts +1 -0
- package/dist/src/core/TextureMemoryManager.js +6 -1
- package/dist/src/core/TextureMemoryManager.js.map +1 -1
- package/dist/src/core/lib/colorCache.d.ts +1 -0
- package/dist/src/core/lib/colorCache.js +19 -0
- package/dist/src/core/lib/colorCache.js.map +1 -0
- package/dist/src/core/lib/colorParser.d.ts +21 -0
- package/dist/src/core/lib/colorParser.js +72 -0
- package/dist/src/core/lib/colorParser.js.map +1 -0
- package/dist/src/core/platforms/Platform.d.ts +37 -0
- package/dist/src/core/platforms/Platform.js +22 -0
- package/dist/src/core/platforms/Platform.js.map +1 -0
- package/dist/src/core/platforms/web/WebPlatform.d.ts +9 -0
- package/dist/src/core/platforms/web/WebPlatform.js +84 -0
- package/dist/src/core/platforms/web/WebPlatform.js.map +1 -0
- package/dist/src/core/renderers/CoreShaderNode.d.ts +59 -0
- package/dist/src/core/renderers/CoreShaderNode.js +113 -0
- package/dist/src/core/renderers/CoreShaderNode.js.map +1 -0
- package/dist/src/core/renderers/CoreShaderProgram.d.ts +4 -0
- package/dist/src/core/renderers/CoreShaderProgram.js +20 -0
- package/dist/src/core/renderers/CoreShaderProgram.js.map +1 -0
- package/dist/src/core/renderers/canvas/CanvasRenderer.d.ts +35 -0
- package/dist/src/core/renderers/canvas/CanvasRenderer.js +201 -0
- package/dist/src/core/renderers/canvas/CanvasRenderer.js.map +1 -0
- package/dist/src/core/renderers/canvas/CanvasShaderNode.d.ts +21 -0
- package/dist/src/core/renderers/canvas/CanvasShaderNode.js +58 -0
- package/dist/src/core/renderers/canvas/CanvasShaderNode.js.map +1 -0
- package/dist/src/core/renderers/canvas/CanvasTexture.d.ts +16 -0
- package/dist/src/core/renderers/canvas/CanvasTexture.js +125 -0
- package/dist/src/core/renderers/canvas/CanvasTexture.js.map +1 -0
- package/dist/src/core/renderers/webgl/WebGlCtxRenderTexture.d.ts +12 -0
- package/dist/src/core/renderers/webgl/WebGlCtxRenderTexture.js +57 -0
- package/dist/src/core/renderers/webgl/WebGlCtxRenderTexture.js.map +1 -0
- package/dist/src/core/renderers/webgl/WebGlCtxSubTexture.d.ts +22 -0
- package/dist/src/core/renderers/webgl/WebGlCtxSubTexture.js +67 -0
- package/dist/src/core/renderers/webgl/WebGlCtxSubTexture.js.map +1 -0
- package/dist/src/core/renderers/webgl/WebGlCtxTexture.d.ts +56 -0
- package/dist/src/core/renderers/webgl/WebGlCtxTexture.js +236 -0
- package/dist/src/core/renderers/webgl/WebGlCtxTexture.js.map +1 -0
- package/dist/src/core/renderers/webgl/WebGlRenderOp.d.ts +44 -0
- package/dist/src/core/renderers/webgl/WebGlRenderOp.js +125 -0
- package/dist/src/core/renderers/webgl/WebGlRenderOp.js.map +1 -0
- package/dist/src/core/renderers/webgl/WebGlRenderer.d.ts +136 -0
- package/dist/src/core/renderers/webgl/WebGlRenderer.js +573 -0
- package/dist/src/core/renderers/webgl/WebGlRenderer.js.map +1 -0
- package/dist/src/core/renderers/webgl/WebGlShaderNode.d.ts +222 -0
- package/dist/src/core/renderers/webgl/WebGlShaderNode.js +331 -0
- package/dist/src/core/renderers/webgl/WebGlShaderNode.js.map +1 -0
- package/dist/src/core/renderers/webgl/WebGlShaderProgram.d.ts +37 -0
- package/dist/src/core/renderers/webgl/WebGlShaderProgram.js +218 -0
- package/dist/src/core/renderers/webgl/WebGlShaderProgram.js.map +1 -0
- package/dist/src/core/renderers/webgl/shaders/effects/LinearGradientEffect.js +23 -18
- package/dist/src/core/renderers/webgl/shaders/effects/LinearGradientEffect.js.map +1 -1
- package/dist/src/core/renderers/webgl/shaders/effects/RadialGradientEffect.d.ts +1 -0
- package/dist/src/core/renderers/webgl/shaders/effects/RadialGradientEffect.js +31 -4
- package/dist/src/core/renderers/webgl/shaders/effects/RadialGradientEffect.js.map +1 -1
- package/dist/src/core/shaders/canvas/Border.d.ts +9 -0
- package/dist/src/core/shaders/canvas/Border.js +57 -0
- package/dist/src/core/shaders/canvas/Border.js.map +1 -0
- package/dist/src/core/shaders/canvas/HolePunch.d.ts +7 -0
- package/dist/src/core/shaders/canvas/HolePunch.js +38 -0
- package/dist/src/core/shaders/canvas/HolePunch.js.map +1 -0
- package/dist/src/core/shaders/canvas/LinearGradient.d.ts +10 -0
- package/dist/src/core/shaders/canvas/LinearGradient.js +48 -0
- package/dist/src/core/shaders/canvas/LinearGradient.js.map +1 -0
- package/dist/src/core/shaders/canvas/RadialGradient.d.ts +11 -0
- package/dist/src/core/shaders/canvas/RadialGradient.js +70 -0
- package/dist/src/core/shaders/canvas/RadialGradient.js.map +1 -0
- package/dist/src/core/shaders/canvas/Rounded.d.ts +7 -0
- package/dist/src/core/shaders/canvas/Rounded.js +33 -0
- package/dist/src/core/shaders/canvas/Rounded.js.map +1 -0
- package/dist/src/core/shaders/canvas/RoundedWithBorder.d.ts +7 -0
- package/dist/src/core/shaders/canvas/RoundedWithBorder.js +43 -0
- package/dist/src/core/shaders/canvas/RoundedWithBorder.js.map +1 -0
- package/dist/src/core/shaders/canvas/RoundedWithBorderAndShadow.d.ts +8 -0
- package/dist/src/core/shaders/canvas/RoundedWithBorderAndShadow.js +41 -0
- package/dist/src/core/shaders/canvas/RoundedWithBorderAndShadow.js.map +1 -0
- package/dist/src/core/shaders/canvas/RoundedWithShadow.d.ts +7 -0
- package/dist/src/core/shaders/canvas/RoundedWithShadow.js +40 -0
- package/dist/src/core/shaders/canvas/RoundedWithShadow.js.map +1 -0
- package/dist/src/core/shaders/canvas/Shadow.d.ts +8 -0
- package/dist/src/core/shaders/canvas/Shadow.js +31 -0
- package/dist/src/core/shaders/canvas/Shadow.js.map +1 -0
- package/dist/src/core/shaders/canvas/utils/render.d.ts +5 -0
- package/dist/src/core/shaders/canvas/utils/render.js +84 -0
- package/dist/src/core/shaders/canvas/utils/render.js.map +1 -0
- package/dist/src/core/shaders/templates/BorderTemplate.d.ts +37 -0
- package/dist/src/core/shaders/templates/BorderTemplate.js +73 -0
- package/dist/src/core/shaders/templates/BorderTemplate.js.map +1 -0
- package/dist/src/core/shaders/templates/HolePunchTemplate.d.ts +46 -0
- package/dist/src/core/shaders/templates/HolePunchTemplate.js +35 -0
- package/dist/src/core/shaders/templates/HolePunchTemplate.js.map +1 -0
- package/dist/src/core/shaders/templates/LinearGradientTemplate.d.ts +23 -0
- package/dist/src/core/shaders/templates/LinearGradientTemplate.js +47 -0
- package/dist/src/core/shaders/templates/LinearGradientTemplate.js.map +1 -0
- package/dist/src/core/shaders/templates/RadialGradientTemplate.d.ts +31 -0
- package/dist/src/core/shaders/templates/RadialGradientTemplate.js +49 -0
- package/dist/src/core/shaders/templates/RadialGradientTemplate.js.map +1 -0
- package/dist/src/core/shaders/templates/RoundedTemplate.d.ts +29 -0
- package/dist/src/core/shaders/templates/RoundedTemplate.js +67 -0
- package/dist/src/core/shaders/templates/RoundedTemplate.js.map +1 -0
- package/dist/src/core/shaders/templates/RoundedWithBorderAndShadowTemplate.d.ts +7 -0
- package/dist/src/core/shaders/templates/RoundedWithBorderAndShadowTemplate.js +24 -0
- package/dist/src/core/shaders/templates/RoundedWithBorderAndShadowTemplate.js.map +1 -0
- package/dist/src/core/shaders/templates/RoundedWithBorderTemplate.d.ts +6 -0
- package/dist/src/core/shaders/templates/RoundedWithBorderTemplate.js +23 -0
- package/dist/src/core/shaders/templates/RoundedWithBorderTemplate.js.map +1 -0
- package/dist/src/core/shaders/templates/RoundedWithShadowTemplate.d.ts +6 -0
- package/dist/src/core/shaders/templates/RoundedWithShadowTemplate.js +23 -0
- package/dist/src/core/shaders/templates/RoundedWithShadowTemplate.js.map +1 -0
- package/dist/src/core/shaders/templates/ShadowTemplate.d.ts +34 -0
- package/dist/src/core/shaders/templates/ShadowTemplate.js +66 -0
- package/dist/src/core/shaders/templates/ShadowTemplate.js.map +1 -0
- package/dist/src/core/shaders/utils.d.ts +5 -0
- package/dist/src/core/shaders/utils.js +41 -0
- package/dist/src/core/shaders/utils.js.map +1 -0
- package/dist/src/core/shaders/webgl/Border.d.ts +3 -0
- package/dist/src/core/shaders/webgl/Border.js +110 -0
- package/dist/src/core/shaders/webgl/Border.js.map +1 -0
- package/dist/src/core/shaders/webgl/Default.d.ts +2 -0
- package/dist/src/core/shaders/webgl/Default.js +86 -0
- package/dist/src/core/shaders/webgl/Default.js.map +1 -0
- package/dist/src/core/shaders/webgl/DefaultBatched.d.ts +2 -0
- package/dist/src/core/shaders/webgl/DefaultBatched.js +104 -0
- package/dist/src/core/shaders/webgl/DefaultBatched.js.map +1 -0
- package/dist/src/core/shaders/webgl/HolePunch.d.ts +3 -0
- package/dist/src/core/shaders/webgl/HolePunch.js +65 -0
- package/dist/src/core/shaders/webgl/HolePunch.js.map +1 -0
- package/dist/src/core/shaders/webgl/LinearGradient.d.ts +3 -0
- package/dist/src/core/shaders/webgl/LinearGradient.js +99 -0
- package/dist/src/core/shaders/webgl/LinearGradient.js.map +1 -0
- package/dist/src/core/shaders/webgl/RadialGradient.d.ts +3 -0
- package/dist/src/core/shaders/webgl/RadialGradient.js +96 -0
- package/dist/src/core/shaders/webgl/RadialGradient.js.map +1 -0
- package/dist/src/core/shaders/webgl/Rounded.d.ts +7 -0
- package/dist/src/core/shaders/webgl/Rounded.js +86 -0
- package/dist/src/core/shaders/webgl/Rounded.js.map +1 -0
- package/dist/src/core/shaders/webgl/RoundedWithBorder.d.ts +3 -0
- package/dist/src/core/shaders/webgl/RoundedWithBorder.js +140 -0
- package/dist/src/core/shaders/webgl/RoundedWithBorder.js.map +1 -0
- package/dist/src/core/shaders/webgl/RoundedWithBorderAndShadow.d.ts +3 -0
- package/dist/src/core/shaders/webgl/RoundedWithBorderAndShadow.js +162 -0
- package/dist/src/core/shaders/webgl/RoundedWithBorderAndShadow.js.map +1 -0
- package/dist/src/core/shaders/webgl/RoundedWithShadow.d.ts +3 -0
- package/dist/src/core/shaders/webgl/RoundedWithShadow.js +84 -0
- package/dist/src/core/shaders/webgl/RoundedWithShadow.js.map +1 -0
- package/dist/src/core/shaders/webgl/SdfShader.d.ts +30 -0
- package/dist/src/core/shaders/webgl/SdfShader.js +107 -0
- package/dist/src/core/shaders/webgl/SdfShader.js.map +1 -0
- package/dist/src/core/shaders/webgl/Shadow.d.ts +3 -0
- package/dist/src/core/shaders/webgl/Shadow.js +110 -0
- package/dist/src/core/shaders/webgl/Shadow.js.map +1 -0
- package/dist/src/core/text-rendering/CanvasFontHandler.d.ts +59 -0
- package/dist/src/core/text-rendering/CanvasFontHandler.js +221 -0
- package/dist/src/core/text-rendering/CanvasFontHandler.js.map +1 -0
- package/dist/src/core/text-rendering/CanvasTextRenderer.d.ts +17 -0
- package/dist/src/core/text-rendering/CanvasTextRenderer.js +157 -0
- package/dist/src/core/text-rendering/CanvasTextRenderer.js.map +1 -0
- package/dist/src/core/text-rendering/SdfFontHandler.d.ts +182 -0
- package/dist/src/core/text-rendering/SdfFontHandler.js +388 -0
- package/dist/src/core/text-rendering/SdfFontHandler.js.map +1 -0
- package/dist/src/core/text-rendering/SdfTextRenderer.d.ts +17 -0
- package/dist/src/core/text-rendering/SdfTextRenderer.js +311 -0
- package/dist/src/core/text-rendering/SdfTextRenderer.js.map +1 -0
- package/dist/src/core/text-rendering/TextLayoutEngine.d.ts +19 -0
- package/dist/src/core/text-rendering/TextLayoutEngine.js +324 -0
- package/dist/src/core/text-rendering/TextLayoutEngine.js.map +1 -0
- package/dist/src/core/text-rendering/TextRenderer.d.ts +368 -0
- package/dist/src/core/text-rendering/TextRenderer.js +20 -0
- package/dist/src/core/text-rendering/TextRenderer.js.map +1 -0
- package/dist/src/core/text-rendering/Utils.d.ts +30 -0
- package/dist/src/core/text-rendering/Utils.js +84 -0
- package/dist/src/core/text-rendering/Utils.js.map +1 -0
- package/dist/src/core/textures/ImageTexture.js +3 -2
- package/dist/src/core/textures/ImageTexture.js.map +1 -1
- package/dist/src/core/textures/Texture.d.ts +2 -1
- package/dist/src/core/textures/Texture.js +2 -1
- package/dist/src/core/textures/Texture.js.map +1 -1
- package/dist/src/main-api/Inspector.js +1 -1
- package/dist/src/main-api/Inspector.js.map +1 -1
- package/dist/src/main-api/Renderer.d.ts +13 -0
- package/dist/src/main-api/Renderer.js +2 -0
- package/dist/src/main-api/Renderer.js.map +1 -1
- package/dist/tsconfig.dist.tsbuildinfo +1 -1
- package/exports/index.ts +5 -0
- package/package.json +1 -1
- package/src/common/CommonTypes.ts +2 -1
- package/src/core/CoreTextureManager.ts +19 -4
- package/src/core/Stage.ts +3 -0
- package/src/core/TextureError.ts +46 -0
- package/src/core/TextureMemoryManager.ts +9 -2
- package/src/core/renderers/webgl/shaders/effects/LinearGradientEffect.ts +23 -18
- package/src/core/renderers/webgl/shaders/effects/RadialGradientEffect.ts +32 -4
- package/src/core/textures/ImageTexture.ts +3 -2
- package/src/core/textures/Texture.ts +5 -3
- package/src/main-api/Inspector.ts +4 -1
- package/src/main-api/Renderer.ts +16 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HolePunchTemplate.js","sourceRoot":"","sources":["../../../../../src/core/shaders/templates/HolePunchTemplate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AA+CnD,MAAM,CAAC,MAAM,iBAAiB,GAAmC;IAC/D,KAAK,EAAE;QACL,CAAC,EAAE,CAAC;QACJ,CAAC,EAAE,CAAC;QACJ,CAAC,EAAE,EAAE;QACL,CAAC,EAAE,EAAE;QACL,MAAM,EAAE;YACN,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;YACrB,OAAO,CAAC,KAAK;gBACX,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;oBACxB,OAAO,oBAAoB,CAAC,KAAK,CAAC,CAAC;gBACrC,CAAC;gBACD,OAAQ,EAAe,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YAC/C,CAAC;SACF;KACF;CACF,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { CoreShaderType } from '../../renderers/CoreShaderNode.js';
|
|
2
|
+
/**
|
|
3
|
+
* Properties of the {@link LinearGradient} shader
|
|
4
|
+
*/
|
|
5
|
+
export interface LinearGradientProps {
|
|
6
|
+
/**
|
|
7
|
+
* Array of colors to be used in the LinearGradient shader
|
|
8
|
+
*
|
|
9
|
+
* @default [0xff000000, 0xffffffff]
|
|
10
|
+
*/
|
|
11
|
+
colors: number[];
|
|
12
|
+
/**
|
|
13
|
+
* Angle of the LinearGradient shader, Angle in Radians
|
|
14
|
+
*
|
|
15
|
+
* @default 0
|
|
16
|
+
*/
|
|
17
|
+
angle: number;
|
|
18
|
+
/**
|
|
19
|
+
* Array of color stops
|
|
20
|
+
*/
|
|
21
|
+
stops: number[];
|
|
22
|
+
}
|
|
23
|
+
export declare const LinearGradientTemplate: CoreShaderType<LinearGradientProps>;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2023 Comcast Cable Communications Management, LLC
|
|
3
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License.
|
|
5
|
+
* You may obtain a copy of the License at
|
|
6
|
+
*
|
|
7
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
*
|
|
9
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
* See the License for the specific language governing permissions and
|
|
13
|
+
* limitations under the License.
|
|
14
|
+
*
|
|
15
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
16
|
+
*/
|
|
17
|
+
export const LinearGradientTemplate = {
|
|
18
|
+
props: {
|
|
19
|
+
colors: {
|
|
20
|
+
default: [0x000000ff, 0xffffffff],
|
|
21
|
+
resolve(value) {
|
|
22
|
+
if (value !== undefined && value.length > 0) {
|
|
23
|
+
return value;
|
|
24
|
+
}
|
|
25
|
+
return [].concat(this.default);
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
stops: {
|
|
29
|
+
default: [0, 1],
|
|
30
|
+
resolve(value, props) {
|
|
31
|
+
if (value !== undefined && value.length === props.colors.length) {
|
|
32
|
+
return value;
|
|
33
|
+
}
|
|
34
|
+
if (value === undefined) {
|
|
35
|
+
value = [];
|
|
36
|
+
}
|
|
37
|
+
const len = props.colors.length;
|
|
38
|
+
for (let i = 0; i < len; i++) {
|
|
39
|
+
value[i] = i * (1 / (len - 1));
|
|
40
|
+
}
|
|
41
|
+
return value;
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
angle: 0,
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
//# sourceMappingURL=LinearGradientTemplate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LinearGradientTemplate.js","sourceRoot":"","sources":["../../../../../src/core/shaders/templates/LinearGradientTemplate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AA0BH,MAAM,CAAC,MAAM,sBAAsB,GAAwC;IACzE,KAAK,EAAE;QACL,MAAM,EAAE;YACN,OAAO,EAAE,CAAC,UAAU,EAAE,UAAU,CAAC;YACjC,OAAO,CAAC,KAAK;gBACX,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;oBAC5C,OAAO,KAAK,CAAC;gBACf,CAAC;gBACD,OAAQ,EAAe,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YAC/C,CAAC;SACF;QACD,KAAK,EAAE;YACL,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;YACf,OAAO,CAAC,KAAK,EAAE,KAAK;gBAClB,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,CAAC,MAAM,KAAK,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;oBAChE,OAAO,KAAK,CAAC;gBACf,CAAC;gBACD,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;oBACxB,KAAK,GAAG,EAAE,CAAC;gBACb,CAAC;gBACD,MAAM,GAAG,GAAG,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC;gBAChC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC;oBAC7B,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;gBACjC,CAAC;gBACD,OAAO,KAAK,CAAC;YACf,CAAC;SACF;QACD,KAAK,EAAE,CAAC;KACT;CACF,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { CoreShaderType } from '../../renderers/CoreShaderNode.js';
|
|
2
|
+
/**
|
|
3
|
+
* Properties of the {@link RadialGradient} shader
|
|
4
|
+
*/
|
|
5
|
+
export interface RadialGradientProps {
|
|
6
|
+
/**
|
|
7
|
+
* Array of colors to be used in the RadialGradient shader
|
|
8
|
+
*
|
|
9
|
+
* @default [0xff000000, 0xffffffff]
|
|
10
|
+
*/
|
|
11
|
+
colors: number[];
|
|
12
|
+
/**
|
|
13
|
+
* Array of color stops
|
|
14
|
+
*/
|
|
15
|
+
stops: number[];
|
|
16
|
+
/**
|
|
17
|
+
* Width of the RadialGradientEffect
|
|
18
|
+
*/
|
|
19
|
+
w: number;
|
|
20
|
+
/**
|
|
21
|
+
* height of the RadialGradientEffect
|
|
22
|
+
*
|
|
23
|
+
* @remarks if not defined uses the width value
|
|
24
|
+
*/
|
|
25
|
+
h: number;
|
|
26
|
+
/**
|
|
27
|
+
* center point of where the RadialGradientEffect is drawn
|
|
28
|
+
*/
|
|
29
|
+
pivot: [number, number];
|
|
30
|
+
}
|
|
31
|
+
export declare const RadialGradientTemplate: CoreShaderType<RadialGradientProps>;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2023 Comcast Cable Communications Management, LLC
|
|
3
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License.
|
|
5
|
+
* You may obtain a copy of the License at
|
|
6
|
+
*
|
|
7
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
*
|
|
9
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
* See the License for the specific language governing permissions and
|
|
13
|
+
* limitations under the License.
|
|
14
|
+
*
|
|
15
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
16
|
+
*/
|
|
17
|
+
export const RadialGradientTemplate = {
|
|
18
|
+
props: {
|
|
19
|
+
colors: {
|
|
20
|
+
default: [0x000000ff, 0xffffffff],
|
|
21
|
+
resolve(value) {
|
|
22
|
+
if (value !== undefined && value.length > 0) {
|
|
23
|
+
return value;
|
|
24
|
+
}
|
|
25
|
+
return [].concat(this.default);
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
stops: {
|
|
29
|
+
default: [0, 1],
|
|
30
|
+
resolve(value, props) {
|
|
31
|
+
if (value !== undefined && value.length === props.colors.length) {
|
|
32
|
+
return value;
|
|
33
|
+
}
|
|
34
|
+
if (value === undefined) {
|
|
35
|
+
value = [];
|
|
36
|
+
}
|
|
37
|
+
const len = props.colors.length;
|
|
38
|
+
for (let i = 0; i < len; i++) {
|
|
39
|
+
value[i] = i * (1 / (len - 1));
|
|
40
|
+
}
|
|
41
|
+
return value;
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
w: 50,
|
|
45
|
+
h: 50,
|
|
46
|
+
pivot: [0.5, 0.5],
|
|
47
|
+
},
|
|
48
|
+
};
|
|
49
|
+
//# sourceMappingURL=RadialGradientTemplate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RadialGradientTemplate.js","sourceRoot":"","sources":["../../../../../src/core/shaders/templates/RadialGradientTemplate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAkCH,MAAM,CAAC,MAAM,sBAAsB,GAAwC;IACzE,KAAK,EAAE;QACL,MAAM,EAAE;YACN,OAAO,EAAE,CAAC,UAAU,EAAE,UAAU,CAAC;YACjC,OAAO,CAAC,KAAK;gBACX,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;oBAC5C,OAAO,KAAK,CAAC;gBACf,CAAC;gBACD,OAAQ,EAAe,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YAC/C,CAAC;SACF;QACD,KAAK,EAAE;YACL,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;YACf,OAAO,CAAC,KAAK,EAAE,KAAK;gBAClB,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,CAAC,MAAM,KAAK,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;oBAChE,OAAO,KAAK,CAAC;gBACf,CAAC;gBACD,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;oBACxB,KAAK,GAAG,EAAE,CAAC;gBACb,CAAC;gBACD,MAAM,GAAG,GAAG,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC;gBAChC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC;oBAC7B,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;gBACjC,CAAC;gBACD,OAAO,KAAK,CAAC;YACf,CAAC;SACF;QACD,CAAC,EAAE,EAAE;QACL,CAAC,EAAE,EAAE;QACL,KAAK,EAAE,CAAC,GAAG,EAAE,GAAG,CAAC;KAClB;CACF,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { CoreShaderType } from '../../renderers/CoreShaderNode.js';
|
|
2
|
+
/**
|
|
3
|
+
* Properties of the {@link RoundedRectangle} shader
|
|
4
|
+
*/
|
|
5
|
+
export interface RoundedProps {
|
|
6
|
+
/**
|
|
7
|
+
* Corner radius, in pixels, to cut out of the corners
|
|
8
|
+
*
|
|
9
|
+
* @defaultValue 0
|
|
10
|
+
*/
|
|
11
|
+
radius: number | number[];
|
|
12
|
+
/**
|
|
13
|
+
* sets top-left corner
|
|
14
|
+
*/
|
|
15
|
+
'top-left': number;
|
|
16
|
+
/**
|
|
17
|
+
* sets top-right corner
|
|
18
|
+
*/
|
|
19
|
+
'top-right': number;
|
|
20
|
+
/**
|
|
21
|
+
* sets bottom-right corner
|
|
22
|
+
*/
|
|
23
|
+
'bottom-right': number;
|
|
24
|
+
/**
|
|
25
|
+
* sets bottom-left corner
|
|
26
|
+
*/
|
|
27
|
+
'bottom-left': number;
|
|
28
|
+
}
|
|
29
|
+
export declare const RoundedTemplate: CoreShaderType<RoundedProps>;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2023 Comcast Cable Communications Management, LLC
|
|
3
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License.
|
|
5
|
+
* You may obtain a copy of the License at
|
|
6
|
+
*
|
|
7
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
*
|
|
9
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
* See the License for the specific language governing permissions and
|
|
13
|
+
* limitations under the License.
|
|
14
|
+
*
|
|
15
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
16
|
+
*/
|
|
17
|
+
import { validateArrayLength4 } from '../utils.js';
|
|
18
|
+
export const RoundedTemplate = {
|
|
19
|
+
props: {
|
|
20
|
+
radius: {
|
|
21
|
+
default: [0, 0, 0, 0],
|
|
22
|
+
resolve(value) {
|
|
23
|
+
if (value !== undefined) {
|
|
24
|
+
return validateArrayLength4(value);
|
|
25
|
+
}
|
|
26
|
+
return [].concat(this.default);
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
'top-left': {
|
|
30
|
+
default: 0,
|
|
31
|
+
set(value, props) {
|
|
32
|
+
props.radius[0] = value;
|
|
33
|
+
},
|
|
34
|
+
get(props) {
|
|
35
|
+
return props.radius[0];
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
'top-right': {
|
|
39
|
+
default: 0,
|
|
40
|
+
set(value, props) {
|
|
41
|
+
props.radius[1] = value;
|
|
42
|
+
},
|
|
43
|
+
get(props) {
|
|
44
|
+
return props.radius[1];
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
'bottom-right': {
|
|
48
|
+
default: 0,
|
|
49
|
+
set(value, props) {
|
|
50
|
+
props.radius[2] = value;
|
|
51
|
+
},
|
|
52
|
+
get(props) {
|
|
53
|
+
return props.radius[2];
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
'bottom-left': {
|
|
57
|
+
default: 0,
|
|
58
|
+
set(value, props) {
|
|
59
|
+
props.radius[3] = value;
|
|
60
|
+
},
|
|
61
|
+
get(props) {
|
|
62
|
+
return props.radius[3];
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
};
|
|
67
|
+
//# sourceMappingURL=RoundedTemplate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RoundedTemplate.js","sourceRoot":"","sources":["../../../../../src/core/shaders/templates/RoundedTemplate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAIH,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AA8BnD,MAAM,CAAC,MAAM,eAAe,GAAiC;IAC3D,KAAK,EAAE;QACL,MAAM,EAAE;YACN,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;YACrB,OAAO,CAAC,KAAK;gBACX,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;oBACxB,OAAO,oBAAoB,CAAC,KAAK,CAAC,CAAC;gBACrC,CAAC;gBACD,OAAQ,EAAe,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YAC/C,CAAC;SACF;QACD,UAAU,EAAE;YACV,OAAO,EAAE,CAAC;YACV,GAAG,CAAC,KAAK,EAAE,KAAK;gBACb,KAAK,CAAC,MAAe,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC;YACpC,CAAC;YACD,GAAG,CAAC,KAAK;gBACP,OAAQ,KAAK,CAAC,MAAe,CAAC,CAAC,CAAC,CAAC;YACnC,CAAC;SACF;QACD,WAAW,EAAE;YACX,OAAO,EAAE,CAAC;YACV,GAAG,CAAC,KAAK,EAAE,KAAK;gBACb,KAAK,CAAC,MAAe,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC;YACpC,CAAC;YACD,GAAG,CAAC,KAAK;gBACP,OAAQ,KAAK,CAAC,MAAe,CAAC,CAAC,CAAC,CAAC;YACnC,CAAC;SACF;QACD,cAAc,EAAE;YACd,OAAO,EAAE,CAAC;YACV,GAAG,CAAC,KAAK,EAAE,KAAK;gBACb,KAAK,CAAC,MAAe,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC;YACpC,CAAC;YACD,GAAG,CAAC,KAAK;gBACP,OAAQ,KAAK,CAAC,MAAe,CAAC,CAAC,CAAC,CAAC;YACnC,CAAC;SACF;QACD,aAAa,EAAE;YACb,OAAO,EAAE,CAAC;YACV,GAAG,CAAC,KAAK,EAAE,KAAK;gBACb,KAAK,CAAC,MAAe,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC;YACpC,CAAC;YACD,GAAG,CAAC,KAAK;gBACP,OAAQ,KAAK,CAAC,MAAe,CAAC,CAAC,CAAC,CAAC;YACnC,CAAC;SACF;KACF;CACF,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { CoreShaderType } from '../../renderers/CoreShaderNode.js';
|
|
2
|
+
import { type BorderProps } from './BorderTemplate.js';
|
|
3
|
+
import { type RoundedProps } from './RoundedTemplate.js';
|
|
4
|
+
import type { PrefixedType } from '../utils.js';
|
|
5
|
+
import { type ShadowProps } from './ShadowTemplate.js';
|
|
6
|
+
export type RoundedWithBorderAndShadowProps = RoundedProps & PrefixedType<BorderProps, 'border'> & PrefixedType<ShadowProps, 'shadow'>;
|
|
7
|
+
export declare const RoundedWithBorderAndShadowTemplate: CoreShaderType<RoundedWithBorderAndShadowProps>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2023 Comcast Cable Communications Management, LLC
|
|
3
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License.
|
|
5
|
+
* You may obtain a copy of the License at
|
|
6
|
+
*
|
|
7
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
*
|
|
9
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
* See the License for the specific language governing permissions and
|
|
13
|
+
* limitations under the License.
|
|
14
|
+
*
|
|
15
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
16
|
+
*/
|
|
17
|
+
import { getBorderProps } from './BorderTemplate.js';
|
|
18
|
+
import { RoundedTemplate } from './RoundedTemplate.js';
|
|
19
|
+
import { getShadowProps } from './ShadowTemplate.js';
|
|
20
|
+
const props = Object.assign({}, RoundedTemplate.props, getBorderProps('border'), getShadowProps('shadow'));
|
|
21
|
+
export const RoundedWithBorderAndShadowTemplate = {
|
|
22
|
+
props,
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=RoundedWithBorderAndShadowTemplate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RoundedWithBorderAndShadowTemplate.js","sourceRoot":"","sources":["../../../../../src/core/shaders/templates/RoundedWithBorderAndShadowTemplate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,OAAO,EAAE,cAAc,EAAoB,MAAM,qBAAqB,CAAC;AACvE,OAAO,EAAE,eAAe,EAAqB,MAAM,sBAAsB,CAAC;AAE1E,OAAO,EAAE,cAAc,EAAoB,MAAM,qBAAqB,CAAC;AAMvE,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CACzB,EAAE,EACF,eAAe,CAAC,KAAK,EACrB,cAAc,CAAC,QAAQ,CAAC,EACxB,cAAc,CAAC,QAAQ,CAAC,CACU,CAAC;AAErC,MAAM,CAAC,MAAM,kCAAkC,GAC7C;IACE,KAAK;CACN,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { CoreShaderType } from '../../renderers/CoreShaderNode.js';
|
|
2
|
+
import { type BorderProps } from './BorderTemplate.js';
|
|
3
|
+
import { type RoundedProps } from './RoundedTemplate.js';
|
|
4
|
+
import type { PrefixedType } from '../utils.js';
|
|
5
|
+
export type RoundedWithBorderProps = RoundedProps & PrefixedType<BorderProps, 'border'>;
|
|
6
|
+
export declare const RoundedWithBorderTemplate: CoreShaderType<RoundedWithBorderProps>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2023 Comcast Cable Communications Management, LLC
|
|
3
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License.
|
|
5
|
+
* You may obtain a copy of the License at
|
|
6
|
+
*
|
|
7
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
*
|
|
9
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
* See the License for the specific language governing permissions and
|
|
13
|
+
* limitations under the License.
|
|
14
|
+
*
|
|
15
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
16
|
+
*/
|
|
17
|
+
import { getBorderProps } from './BorderTemplate.js';
|
|
18
|
+
import { RoundedTemplate } from './RoundedTemplate.js';
|
|
19
|
+
const props = Object.assign({}, RoundedTemplate.props, getBorderProps('border'));
|
|
20
|
+
export const RoundedWithBorderTemplate = {
|
|
21
|
+
props,
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=RoundedWithBorderTemplate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RoundedWithBorderTemplate.js","sourceRoot":"","sources":["../../../../../src/core/shaders/templates/RoundedWithBorderTemplate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,OAAO,EAAE,cAAc,EAAoB,MAAM,qBAAqB,CAAC;AACvE,OAAO,EAAE,eAAe,EAAqB,MAAM,sBAAsB,CAAC;AAM1E,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CACzB,EAAE,EACF,eAAe,CAAC,KAAK,EACrB,cAAc,CAAC,QAAQ,CAAC,CACC,CAAC;AAE5B,MAAM,CAAC,MAAM,yBAAyB,GACpC;IACE,KAAK;CACN,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { CoreShaderType } from '../../renderers/CoreShaderNode.js';
|
|
2
|
+
import { type RoundedProps } from './RoundedTemplate.js';
|
|
3
|
+
import type { PrefixedType } from '../utils.js';
|
|
4
|
+
import { type ShadowProps } from './ShadowTemplate.js';
|
|
5
|
+
export type RoundedWithShadowProps = RoundedProps & PrefixedType<ShadowProps, 'shadow'>;
|
|
6
|
+
export declare const RoundedWithShadowTemplate: CoreShaderType<RoundedWithShadowProps>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2023 Comcast Cable Communications Management, LLC
|
|
3
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License.
|
|
5
|
+
* You may obtain a copy of the License at
|
|
6
|
+
*
|
|
7
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
*
|
|
9
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
* See the License for the specific language governing permissions and
|
|
13
|
+
* limitations under the License.
|
|
14
|
+
*
|
|
15
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
16
|
+
*/
|
|
17
|
+
import { RoundedTemplate } from './RoundedTemplate.js';
|
|
18
|
+
import { getShadowProps } from './ShadowTemplate.js';
|
|
19
|
+
const props = Object.assign({}, RoundedTemplate.props, getShadowProps('shadow'));
|
|
20
|
+
export const RoundedWithShadowTemplate = {
|
|
21
|
+
props,
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=RoundedWithShadowTemplate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RoundedWithShadowTemplate.js","sourceRoot":"","sources":["../../../../../src/core/shaders/templates/RoundedWithShadowTemplate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,OAAO,EAAE,eAAe,EAAqB,MAAM,sBAAsB,CAAC;AAE1E,OAAO,EAAE,cAAc,EAAoB,MAAM,qBAAqB,CAAC;AAKvE,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CACzB,EAAE,EACF,eAAe,CAAC,KAAK,EACrB,cAAc,CAAC,QAAQ,CAAC,CACC,CAAC;AAE5B,MAAM,CAAC,MAAM,yBAAyB,GACpC;IACE,KAAK;CACN,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { CoreShaderType } from '../../renderers/CoreShaderNode.js';
|
|
2
|
+
import type { PrefixedType } from '../utils.js';
|
|
3
|
+
export interface ShadowProps {
|
|
4
|
+
/**
|
|
5
|
+
* Shadow Color
|
|
6
|
+
*
|
|
7
|
+
* @default 0x000000ff
|
|
8
|
+
*/
|
|
9
|
+
color: number;
|
|
10
|
+
/**
|
|
11
|
+
* Shadow Projection [offsetX, offsetY, blur, spread]
|
|
12
|
+
*
|
|
13
|
+
* @default [0, 0, 5, 5]
|
|
14
|
+
*/
|
|
15
|
+
projection: [number, number, number, number];
|
|
16
|
+
/**
|
|
17
|
+
* OffsetX of Shadow (center)
|
|
18
|
+
*/
|
|
19
|
+
x: number;
|
|
20
|
+
/**
|
|
21
|
+
* OffsetY of Shadow (center)
|
|
22
|
+
*/
|
|
23
|
+
y: number;
|
|
24
|
+
/**
|
|
25
|
+
* Blur along the edges of the Shadow
|
|
26
|
+
*/
|
|
27
|
+
blur: number;
|
|
28
|
+
/**
|
|
29
|
+
* Spread of the shadow compared to node
|
|
30
|
+
*/
|
|
31
|
+
spread: number;
|
|
32
|
+
}
|
|
33
|
+
export declare function getShadowProps<P extends string>(prefix?: P): PrefixedType<ShadowProps, P>;
|
|
34
|
+
export declare const ShadowTemplate: CoreShaderType<ShadowProps>;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2023 Comcast Cable Communications Management, LLC
|
|
3
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License.
|
|
5
|
+
* You may obtain a copy of the License at
|
|
6
|
+
*
|
|
7
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
*
|
|
9
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
* See the License for the specific language governing permissions and
|
|
13
|
+
* limitations under the License.
|
|
14
|
+
*
|
|
15
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
16
|
+
*/
|
|
17
|
+
export function getShadowProps(prefix) {
|
|
18
|
+
const pf = prefix && prefix.length > 0 ? `${prefix}-` : '';
|
|
19
|
+
const projection = pf + 'projection';
|
|
20
|
+
return {
|
|
21
|
+
[pf + 'color']: 0x000000ff,
|
|
22
|
+
[projection]: {
|
|
23
|
+
default: [0, 0, 5, 5],
|
|
24
|
+
},
|
|
25
|
+
[pf + 'x']: {
|
|
26
|
+
default: 0,
|
|
27
|
+
set(value, props) {
|
|
28
|
+
props[projection][0] = value;
|
|
29
|
+
},
|
|
30
|
+
get(props) {
|
|
31
|
+
return props[projection][0];
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
[pf + 'y']: {
|
|
35
|
+
default: 0,
|
|
36
|
+
set(value, props) {
|
|
37
|
+
props[projection][1] = value;
|
|
38
|
+
},
|
|
39
|
+
get(props) {
|
|
40
|
+
return props[projection][1];
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
[pf + 'blur']: {
|
|
44
|
+
default: 10,
|
|
45
|
+
set(value, props) {
|
|
46
|
+
props[projection][2] = value;
|
|
47
|
+
},
|
|
48
|
+
get(props) {
|
|
49
|
+
return props[projection][2];
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
[pf + 'spread']: {
|
|
53
|
+
default: 10,
|
|
54
|
+
set(value, props) {
|
|
55
|
+
props[projection][3] = value;
|
|
56
|
+
},
|
|
57
|
+
get(props) {
|
|
58
|
+
return props[projection][3];
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
export const ShadowTemplate = {
|
|
64
|
+
props: getShadowProps(),
|
|
65
|
+
};
|
|
66
|
+
//# sourceMappingURL=ShadowTemplate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ShadowTemplate.js","sourceRoot":"","sources":["../../../../../src/core/shaders/templates/ShadowTemplate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAoCH,MAAM,UAAU,cAAc,CAC5B,MAAU;IAEV,MAAM,EAAE,GAAG,MAAM,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,MAAM,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;IAC3D,MAAM,UAAU,GAAG,EAAE,GAAG,YAAY,CAAC;IAErC,OAAO;QACL,CAAC,EAAE,GAAG,OAAO,CAAC,EAAE,UAAU;QAC1B,CAAC,UAAU,CAAC,EAAE;YACZ,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;SACtB;QACD,CAAC,EAAE,GAAG,GAAG,CAAC,EAAE;YACV,OAAO,EAAE,CAAC;YACV,GAAG,CAAC,KAAK,EAAE,KAAK;gBACd,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC;YAC/B,CAAC;YACD,GAAG,CAAC,KAAK;gBACP,OAAO,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;YAC9B,CAAC;SACF;QACD,CAAC,EAAE,GAAG,GAAG,CAAC,EAAE;YACV,OAAO,EAAE,CAAC;YACV,GAAG,CAAC,KAAK,EAAE,KAAK;gBACd,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC;YAC/B,CAAC;YACD,GAAG,CAAC,KAAK;gBACP,OAAO,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;YAC9B,CAAC;SACF;QACD,CAAC,EAAE,GAAG,MAAM,CAAC,EAAE;YACb,OAAO,EAAE,EAAE;YACX,GAAG,CAAC,KAAK,EAAE,KAAK;gBACd,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC;YAC/B,CAAC;YACD,GAAG,CAAC,KAAK;gBACP,OAAO,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;YAC9B,CAAC;SACF;QACD,CAAC,EAAE,GAAG,QAAQ,CAAC,EAAE;YACf,OAAO,EAAE,EAAE;YACX,GAAG,CAAC,KAAK,EAAE,KAAK;gBACd,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC;YAC/B,CAAC;YACD,GAAG,CAAC,KAAK;gBACP,OAAO,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;YAC9B,CAAC;SACF;KAC8B,CAAC;AACpC,CAAC;AAID,MAAM,CAAC,MAAM,cAAc,GAAgC;IACzD,KAAK,EAAE,cAAc,EAAsB;CAC5C,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Vec4 } from '../renderers/webgl/internal/ShaderUtils.js';
|
|
2
|
+
export declare const validateArrayLength4: (value: number | number[]) => Vec4;
|
|
3
|
+
export type PrefixedType<T, P extends string | undefined = undefined> = {
|
|
4
|
+
[Key in keyof T as P extends string ? `${P}-${string & Key}` : Key]: T[Key];
|
|
5
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2023 Comcast Cable Communications Management, LLC
|
|
3
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License.
|
|
5
|
+
* You may obtain a copy of the License at
|
|
6
|
+
*
|
|
7
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
*
|
|
9
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
* See the License for the specific language governing permissions and
|
|
13
|
+
* limitations under the License.
|
|
14
|
+
*
|
|
15
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
16
|
+
*/
|
|
17
|
+
import { assertTruthy } from '../../utils.js';
|
|
18
|
+
export const validateArrayLength4 = (value) => {
|
|
19
|
+
if (!Array.isArray(value)) {
|
|
20
|
+
return [value, value, value, value];
|
|
21
|
+
}
|
|
22
|
+
assertTruthy(value);
|
|
23
|
+
if (value.length === 4) {
|
|
24
|
+
return value;
|
|
25
|
+
}
|
|
26
|
+
if (value.length === 3) {
|
|
27
|
+
value[3] = value[0];
|
|
28
|
+
return value;
|
|
29
|
+
}
|
|
30
|
+
if (value.length === 2) {
|
|
31
|
+
value[2] = value[0];
|
|
32
|
+
value[3] = value[1];
|
|
33
|
+
return value;
|
|
34
|
+
}
|
|
35
|
+
value[0] = value[0] || 0;
|
|
36
|
+
value[1] = value[0];
|
|
37
|
+
value[2] = value[0];
|
|
38
|
+
value[3] = value[0];
|
|
39
|
+
return value;
|
|
40
|
+
};
|
|
41
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../src/core/shaders/utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAG9C,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,KAAwB,EAAQ,EAAE;IACrE,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QAC1B,OAAO,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;IACtC,CAAC;IACD,YAAY,CAAC,KAAK,CAAC,CAAC;IACpB,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACvB,OAAO,KAAa,CAAC;IACvB,CAAC;IACD,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACvB,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAE,CAAC;QACrB,OAAO,KAAa,CAAC;IACvB,CAAC;IACD,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACvB,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAE,CAAC;QACrB,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAE,CAAC;QACrB,OAAO,KAAa,CAAC;IACvB,CAAC;IACD,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IACzB,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;IACpB,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;IACpB,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;IACpB,OAAO,KAAa,CAAC;AACvB,CAAC,CAAC"}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2023 Comcast Cable Communications Management, LLC
|
|
3
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License.
|
|
5
|
+
* You may obtain a copy of the License at
|
|
6
|
+
*
|
|
7
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
*
|
|
9
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
* See the License for the specific language governing permissions and
|
|
13
|
+
* limitations under the License.
|
|
14
|
+
*
|
|
15
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
16
|
+
*/
|
|
17
|
+
import { valuesAreEqual } from '../../lib/utils.js';
|
|
18
|
+
import { BorderTemplate, } from '../templates/BorderTemplate.js';
|
|
19
|
+
export const Border = {
|
|
20
|
+
props: BorderTemplate.props,
|
|
21
|
+
update(node) {
|
|
22
|
+
this.uniform4fa('u_borderWidth', this.props.w);
|
|
23
|
+
this.uniformRGBA('u_borderColor', this.props.color);
|
|
24
|
+
},
|
|
25
|
+
vertex: `
|
|
26
|
+
# ifdef GL_FRAGMENT_PRECISION_HIGH
|
|
27
|
+
precision highp float;
|
|
28
|
+
# else
|
|
29
|
+
precision mediump float;
|
|
30
|
+
# endif
|
|
31
|
+
|
|
32
|
+
attribute vec2 a_position;
|
|
33
|
+
attribute vec2 a_textureCoords;
|
|
34
|
+
attribute vec4 a_color;
|
|
35
|
+
attribute vec2 a_nodeCoords;
|
|
36
|
+
|
|
37
|
+
uniform vec2 u_resolution;
|
|
38
|
+
uniform float u_pixelRatio;
|
|
39
|
+
uniform vec2 u_dimensions;
|
|
40
|
+
|
|
41
|
+
uniform vec4 u_radius;
|
|
42
|
+
uniform vec4 u_borderWidth;
|
|
43
|
+
|
|
44
|
+
varying vec4 v_color;
|
|
45
|
+
varying vec2 v_textureCoords;
|
|
46
|
+
varying vec2 v_nodeCoords;
|
|
47
|
+
|
|
48
|
+
varying vec2 v_innerSize;
|
|
49
|
+
varying vec2 v_halfDimensions;
|
|
50
|
+
|
|
51
|
+
void main() {
|
|
52
|
+
vec2 normalized = a_position * u_pixelRatio;
|
|
53
|
+
vec2 screenSpace = vec2(2.0 / u_resolution.x, -2.0 / u_resolution.y);
|
|
54
|
+
|
|
55
|
+
v_color = a_color;
|
|
56
|
+
v_nodeCoords = a_nodeCoords;
|
|
57
|
+
v_textureCoords = a_textureCoords;
|
|
58
|
+
|
|
59
|
+
v_halfDimensions = u_dimensions * 0.5;
|
|
60
|
+
v_innerSize = vec2(u_dimensions.x - (u_borderWidth[3] + u_borderWidth[1]), u_dimensions.y - (u_borderWidth[0] + u_borderWidth[2])) * 0.5 - 0.5;
|
|
61
|
+
|
|
62
|
+
gl_Position = vec4(normalized.x * screenSpace.x - 1.0, normalized.y * -abs(screenSpace.y) + 1.0, 0.0, 1.0);
|
|
63
|
+
gl_Position.y = -sign(screenSpace.y) * gl_Position.y;
|
|
64
|
+
}
|
|
65
|
+
`,
|
|
66
|
+
fragment: `
|
|
67
|
+
# ifdef GL_FRAGMENT_PRECISION_HIGH
|
|
68
|
+
precision highp float;
|
|
69
|
+
# else
|
|
70
|
+
precision mediump float;
|
|
71
|
+
# endif
|
|
72
|
+
|
|
73
|
+
uniform vec2 u_resolution;
|
|
74
|
+
uniform float u_pixelRatio;
|
|
75
|
+
uniform float u_alpha;
|
|
76
|
+
|
|
77
|
+
uniform vec2 u_dimensions;
|
|
78
|
+
uniform sampler2D u_texture;
|
|
79
|
+
|
|
80
|
+
uniform vec4 u_borderWidth;
|
|
81
|
+
uniform vec4 u_borderColor;
|
|
82
|
+
|
|
83
|
+
varying vec4 v_color;
|
|
84
|
+
varying vec2 v_nodeCoords;
|
|
85
|
+
varying vec2 v_textureCoords;
|
|
86
|
+
|
|
87
|
+
varying vec2 v_innerSize;
|
|
88
|
+
varying vec2 v_halfDimensions;
|
|
89
|
+
|
|
90
|
+
float box(vec2 p, vec2 s) {
|
|
91
|
+
vec2 q = abs(p) - s;
|
|
92
|
+
return (min(max(q.x, q.y), 0.0) + length(max(q, 0.0)));
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
void main() {
|
|
96
|
+
vec4 color = texture2D(u_texture, v_textureCoords) * v_color;
|
|
97
|
+
vec2 boxUv = v_nodeCoords.xy * u_dimensions - v_halfDimensions;
|
|
98
|
+
|
|
99
|
+
boxUv.x += u_borderWidth.y > u_borderWidth.w ? (u_borderWidth.y - u_borderWidth.w) * 0.5 : -(u_borderWidth.w - u_borderWidth.y) * 0.5;
|
|
100
|
+
boxUv.y += u_borderWidth.z > u_borderWidth.x ? (u_borderWidth.z - u_borderWidth.x) * 0.5 : -(u_borderWidth.x - u_borderWidth.z) * 0.5;
|
|
101
|
+
|
|
102
|
+
float innerDist = box(boxUv, v_innerSize);
|
|
103
|
+
float innerAlpha = 1.0 - smoothstep(0.0, 1.0, innerDist);
|
|
104
|
+
|
|
105
|
+
vec4 resColor = mix(u_borderColor, color, innerAlpha);
|
|
106
|
+
gl_FragColor = resColor * u_alpha;
|
|
107
|
+
}
|
|
108
|
+
`,
|
|
109
|
+
};
|
|
110
|
+
//# sourceMappingURL=Border.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Border.js","sourceRoot":"","sources":["../../../../../src/core/shaders/webgl/Border.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EACL,cAAc,GAEf,MAAM,gCAAgC,CAAC;AAIxC,MAAM,CAAC,MAAM,MAAM,GAAiC;IAClD,KAAK,EAAE,cAAc,CAAC,KAAK;IAC3B,MAAM,CAAC,IAAI;QACT,IAAI,CAAC,UAAU,CAAC,eAAe,EAAE,IAAI,CAAC,KAAM,CAAC,CAAS,CAAC,CAAC;QACxD,IAAI,CAAC,WAAW,CAAC,eAAe,EAAE,IAAI,CAAC,KAAM,CAAC,KAAK,CAAC,CAAC;IACvD,CAAC;IACD,MAAM,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCP;IACD,QAAQ,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CT;CACF,CAAC"}
|