This commit is contained in:
syuilo 2025-11-07 12:45:47 +09:00
parent 78d65ef3dd
commit 990be44d98
3 changed files with 4 additions and 4 deletions

View File

@ -20,7 +20,7 @@ export type ImageCompositorFunction<PS extends ImageCompositorFunctionParams = I
}) => void;
};
export type ImageCompositorLayer<FNS extends Record<string, ImageCompositorFunction> = any> = {
export type ImageCompositorLayer<FNS extends Record<string, ImageCompositorFunction> = Record<string, ImageCompositorFunction>> = {
[K in keyof FNS]: {
id: string;
functionId: K;
@ -219,7 +219,7 @@ export class ImageCompositor<FNS extends Record<string, ImageCompositorFunction<
gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, resultTexture, 0);
}
this.renderLayer(layer, preTexture, isLast);
this.renderLayer(layer as ImageCompositorLayer, preTexture, isLast);
preTexture = resultTexture;
}

View File

@ -4,7 +4,7 @@
*/
import { FXS } from './fxs.js';
import type { ImageCompositorFunction, ImageCompositorLayer } from '@/lib/ImageCompositor.js';
import type { ImageCompositorFunction } from '@/lib/ImageCompositor.js';
import { ImageCompositor } from '@/lib/ImageCompositor.js';
export type ImageEffectorRGB = [r: number, g: number, b: number];

View File

@ -33,7 +33,7 @@ export const fn = defineImageCompositorFunction<Partial<{
gl.uniform1i(u.noBBoxExpansion, params.noBoundingBoxExpansion ? 1 : 0);
// ウォーターマークテクスチャ
const wm = textures.get(params.watermark);
const wm = params.watermark ? textures.get(params.watermark) : null;
if (wm) {
gl.activeTexture(gl.TEXTURE1);
gl.bindTexture(gl.TEXTURE_2D, wm.texture);