internal static Effect GetDefaultEffect(bool clipPlane, bool lightning, int bones) { var key = 0; if (clipPlane) { key |= 1; } if (lightning) { key |= 2; } if (bones > 0) { key |= bones << 2; } if (_defaultEffects[key] != null) { return(_defaultEffects[key]); } if (_defaultMultiEffect == null) { _defaultMultiEffect = new MultiVariantEffect(() => { return(Assembly.OpenResourceStream("Resources.Effects.DefaultEffect.efb")); }); } var defines = new Dictionary <string, string>(); if (clipPlane) { defines["CLIP_PLANE"] = "1"; } if (lightning) { defines["LIGHTNING"] = "1"; } if (bones > 0) { defines["BONES"] = bones.ToString(); } var result = _defaultMultiEffect.GetEffect(Nrs.GraphicsDevice, defines); _defaultEffects[key] = result; return(result); }
internal static Effect GetSkyboxEffect() { if (_skyboxEffect != null) { return(_skyboxEffect); } if (_skyboxMultiEffect == null) { _skyboxMultiEffect = new MultiVariantEffect(() => { return(Assembly.OpenResourceStream("Resources.Effects.SkyboxEffect.efb")); }); } _skyboxEffect = _skyboxMultiEffect.GetEffect(Nrs.GraphicsDevice, null); return(_skyboxEffect); }