public static void ReadBlendType(XmlReader reader, string name, ref EBlendType blendType) { string attr = reader.GetAttribute(name); if (attr != null) { blendType = (EBlendType)Enum.Parse(typeof(EBlendType), attr); } }
private static BlendMode GetBlendMode(EBlendType blendType) { BlendMode mode = BlendMode.Opaque; if (blendType == EBlendType.Cutout) { mode = BlendMode.Cutout; } else if (blendType == EBlendType.CutoutTransparent) { mode = BlendMode.CutoutTransparent; } else if (blendType == EBlendType.Transparent) { mode = BlendMode.Transparent; } return(mode); }
public void SetBlendType(EBlendType value) { switch (value) { case EBlendType.DisableBlend: Disable(); break; case EBlendType.AlphaBlend: InitForTranslucency(); break; case EBlendType.AddColor: { BlendEnable = 1; SrcBlend = EBlend.BLD_SRC_ALPHA; DestBlend = EBlend.BLD_ONE; BlendOp = EBlendOp.BLDOP_ADD; SrcBlendAlpha = EBlend.BLD_ZERO; DestBlendAlpha = EBlend.BLD_ONE; BlendOpAlpha = EBlendOp.BLDOP_ADD; RenderTargetWriteMask = 0x0F; } break; case EBlendType.SubColor: { BlendEnable = 1; SrcBlend = EBlend.BLD_SRC_ALPHA; DestBlend = EBlend.BLD_ONE; BlendOp = EBlendOp.BLDOP_SUBTRACT; SrcBlendAlpha = EBlend.BLD_ZERO; DestBlendAlpha = EBlend.BLD_ONE; BlendOpAlpha = EBlendOp.BLDOP_ADD; RenderTargetWriteMask = 0x0F; } break; } }