Make priority an option to texture masks

This commit is contained in:
dynilath 2025-04-09 16:56:09 +08:00
parent 963097b98b
commit eda0722107
No known key found for this signature in database
3 changed files with 10 additions and 2 deletions
BondageClub

View file

@ -809,6 +809,8 @@ type AssetDefinition = (
interface AssetLayerMaskTexureDefinition {
/** The groups that will be affected */
Groups: AssetGroupName[];
/** If true, the texture mask will apply to all layers in the groups specified, event if their priority is higher than the mask layer */
ApplyToAbove?: boolean;
}
interface AssetLayerDefinition extends AssetCommonPropertiesGroupAssetLayer, AssetCommonPropertiesAssetLayer {

View file

@ -95,11 +95,14 @@ function CommonDrawAppearancePrepareMaskLayers(C) {
const urlParts = [asset.Name, parentAssetName, layerType, layerSegment].filter(c => c);
const layerURL = urlParts.join("_") + ".png";
const maskPriority = layer.TextureMask.ApplyToAbove ? -1 : (item.Property?.OverridePriority?.[layer.Name] ?? layer.Priority);
/** @type {TextureAlphaMask} */
const maskLayer = {
Url: baseURL + layerURL,
X, Y,
Mode: blendingMode,
Priority: maskPriority,
};
/** @type {TextureAlphaMask} */
@ -107,6 +110,7 @@ function CommonDrawAppearancePrepareMaskLayers(C) {
Url: baseURLBlink + layerURL,
X, Y,
Mode: blendingMode,
Priority: maskPriority,
};
for(const maskedGroup of layer.TextureMask.Groups) {
@ -341,8 +345,8 @@ function CommonDrawAppearanceBuild(C, {
// prepare mask layers for the current group
const maskLayer = maskTexLayers.get(groupName) ?? [];
const maskLayerBlink = maskTexLayersBlink.get(groupName) ?? [];
const maskLayer = (maskTexLayers.get(groupName) ?? []).filter(m => m.Priority < 0 || m.Priority >= layer.Priority);
const maskLayerBlink = (maskTexLayersBlink.get(groupName) ?? []).filter(m => m.Priority < 0 || m.Priority >= layer.Priority);
if (shouldColorize) {
drawImageColorize(

View file

@ -3855,6 +3855,8 @@ interface TextureAlphaMask {
Y: number;
Url: string;
Mode: "destination-in" | "destination-out";
/** The priority of the mask, -1 means it will ignores priority and applied to the layers on top of it */
Priority: number;
}
/** Options available to most draw calls */