Ejemplo n.º 1
0
        public static VShader ParseXml(XmlElement el)
        {
            VShader shader = new VShader();

            Shader.ParseXml(el, shader);
            return(shader);
        }
Ejemplo n.º 2
0
        public static DEffect LoadEffect(XmlDocument xml)
        {
            Param.InitKnownTypes();

            DEffect effect = new DEffect();

            XmlElement effectEl = (XmlElement)xml.SelectSingleNode("/effect");

            effect.name = effectEl.Attributes["name"].InnerText;

            // parse params
            XmlNodeList paramEls = xml.SelectNodes("/effect/param");

            effect._params = new Dictionary <string, Param>(paramEls.Count);
            for (int i = 0; i < paramEls.Count; i++)
            {
                Param p = Param.ParseXmlElement((XmlElement)paramEls[i]);
                effect._params[p.Name] = p;
            }

            // parse shaders
            XmlNodeList shaderEls = xml.SelectSingleNode("/effect/shaders").ChildNodes;

            effect.shaders = new Dictionary <string, Shader>(shaderEls.Count);
            for (int i = 0; i < shaderEls.Count; i++)
            {
                Shader s = null;
                if (shaderEls[i].Name == "vshader")
                {
                    s = VShader.ParseXml((XmlElement)shaderEls[i]);
                }
                else if (shaderEls[i].Name == "pshader")
                {
                    s = PShader.ParseXml((XmlElement)shaderEls[i]);
                }
                effect.shaders[s.ID] = s;
            }

            // parse techniques
            XmlNodeList techniqueEls = effectEl.SelectNodes("technique");

            effect.techniques = new Dictionary <string, Technique>(techniqueEls.Count);
            for (int i = 0; i < techniqueEls.Count; i++)
            {
                Technique technique = Technique.ParseXmlElement((XmlElement)techniqueEls[i], effect.shaders);
                effect.techniques.Add(technique.Name, technique);
            }

            effect.ProcessAndVerify();

            return(effect);
        }
Ejemplo n.º 3
0
 public static VShader ParseXml(XmlElement el)
 {
     VShader shader = new VShader();
     Shader.ParseXml(el, shader);
     return shader;
 }
Ejemplo n.º 4
0
 public Pass(VShader vshader, PShader pshader)
 {
     this.vShader = vshader;
     this.pShader = pshader;
 }
Ejemplo n.º 5
0
 public Pass(VShader vshader, PShader pshader)
 {
     this.vShader = vshader;
     this.pShader = pshader;
 }