using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework;

using EVE.EVEObjects;
using EVE.EVECameras;

namespace EVE.EVEShaders
{
    public delegate void EVEShaderPH(Effect myEffect, EVEObject myObject);

    public class EVEShader
    {
        internal string myAsset;
        internal Effect myEffect;

        internal Effect Effect { get { return myEffect; } }
        public event EVEShaderPH SetCustomParams;

        public EVEShader(string asset)
        {
            myAsset = asset;
        }

        public void SetTechnique(string technique)
        {
            myEffect.CurrentTechnique = myEffect.Techniques[technique];
        }

        internal virtual void LoadContent(GraphicsDevice myDevice, ContentManager myLoader)
        {
            myEffect = myLoader.Load<Effect>(myAsset);
        }

        internal virtual void SetParameters(EVEObject myObject)
        {
            if (null != SetCustomParams) SetCustomParams(myEffect, myObject);
        }
    }
}