示例#1
0
        float outlineThreshold = 0.2f; // current edge detection threshold

        #endregion Fields

        #region Constructors

        public CelShadingEffect(GameScreen screen)
            : base(screen)
        {
            /* Set our light direction for the cel-shader
             */
            lightDirection = new Vector4 (0.0f, 0.0f, 1.0f, 1.0f);

            /* Load and initialize the cel-shader effect
             */
            celShader = screen.LoadEffect ("CelShader");
            celShader.Parameters ["LightDirection"].SetValue (lightDirection);
            celMap = screen.content.Load<Texture2D> ("CelMap");
            celShader.Parameters ["Color"].SetValue (Color.Green.ToVector4 ());
            celShader.Parameters ["CelMap"].SetValue (celMap);

            /* Load and initialize the outline shader effect
             */
            outlineShader = screen.LoadEffect ("OutlineShader");
            outlineShader.Parameters ["Thickness"].SetValue (outlineThickness);
            outlineShader.Parameters ["Threshold"].SetValue (outlineThreshold);
            outlineShader.Parameters ["ScreenSize"].SetValue (
                new Vector2 (screen.viewport.Bounds.Width, screen.viewport.Bounds.Height));
        }
示例#2
0
 public BlurEffect(GameScreen screen)
     : base(screen)
 {
     testEffect = screen.LoadEffect ("blur");
 }