// tint texture private Action <EffectSpecialPaintShop> TintAction(SourceReady original, [CanBeNull] SourceReady mask, [CanBeNull] SourceReady overlay, Color[] colors, double alphaAdd) => e => { original.Set(e.FxInputMap, e.FxInputMapChannels); overlay.Set(e.FxOverlayMap, e.FxOverlayMapChannels); e.FxColor.Set(new Vector4(colors[0].R / 255f, colors[0].G / 255f, colors[0].B / 255f, (float)alphaAdd)); if (mask != null) { mask.Set(e.FxMaskMap, e.FxMaskMapChannels); var vColors = new Vector4[3]; var i = 0; for (; i < colors.Length - 1; i++) { vColors[i] = colors[i + 1].ToVector4(); } for (; i < 3; i++) { vColors[i] = new Vector4(1f); } e.FxColors.Set(vColors); e.TechTintMask.DrawAllPasses(DeviceContext, 6); } else { e.TechTint.DrawAllPasses(DeviceContext, 6); } };
// txMaps private Action <EffectSpecialPaintShop> MapsAction(SourceReady original, SourceReady mask, double reflection, double gloss, double specular, bool fixGloss) => e => { original.Set(e.FxInputMap, e.FxInputMapChannels); mask.Set(e.FxMaskMap, e.FxMaskMapChannels); e.FxUseMask.Set(mask != null); e.FxColor.Set(new Vector4((float)specular, (float)gloss, (float)reflection, 1f)); (fixGloss ? e.TechMapsFillGreen : e.TechMaps).DrawAllPasses(DeviceContext, 6); };
// pattern private Action <EffectSpecialPaintShop> PatternAction(SourceReady patternView, SourceReady aoView, SourceReady overlayView, Color[] colors) => e => { patternView.Set(e.FxInputMap, e.FxInputMapChannels); aoView.Set(e.FxAoMap, e.FxAoMapChannels); overlayView.Set(e.FxOverlayMap, e.FxOverlayMapChannels); if (colors.Length > 0) { var vColors = new Vector4[3]; for (var i = 0; i < colors.Length; i++) { vColors[i] = colors[i].ToVector4(); } e.FxColors.Set(vColors); e.TechColorfulPattern.DrawAllPasses(DeviceContext, 6); } else { e.TechPattern.DrawAllPasses(DeviceContext, 6); } };
// simple replacement private Action <EffectSpecialPaintShop> OverrideAction(SourceReady input) => e => { input.Set(e.FxInputMap, e.FxInputMapChannels); e.TechReplacement.DrawAllPasses(DeviceContext, 6); };