Exemplo n.º 1
0
        private void ParseTechnique(UnifiedShaderInfo info, List <UnifiedShaderToken> tokens)
        {
            var name = ConsumeToken(tokens);

            ExpectToken(name, UnifiedShaderTokenType.StringToken);
            ExpectToken(ConsumeToken(tokens), UnifiedShaderTokenType.OpenBrace);

            var technique = new TechniqueInfo
            {
                Name   = name.Text,
                Passes = new List <PassInfo>()
            };

            while (tokens[0].TokenType == UnifiedShaderTokenType.StringToken &&
                   tokens[0].Text == "pass")
            {
                var pass = new PassInfo();
                ExpectToken(ConsumeToken(tokens), "pass");
                var passName = ConsumeToken(tokens);
                ExpectToken(passName, UnifiedShaderTokenType.StringToken);
                pass.Name = passName.Text;
                ParsePass(pass, tokens);
                technique.Passes.Add(pass);
            }

            info.Techniques.Add(technique);

            ExpectToken(ConsumeToken(tokens), UnifiedShaderTokenType.CloseBrace);
        }
        private void ParseTechnique(UnifiedShaderInfo info, List<UnifiedShaderToken> tokens)
        {
            var name = ConsumeToken(tokens);
            ExpectToken(name, UnifiedShaderTokenType.StringToken);
            ExpectToken(ConsumeToken(tokens), UnifiedShaderTokenType.OpenBrace);

            var technique = new TechniqueInfo
            {
                Name = name.Text,
                Passes = new List<PassInfo>()
            };

            while (tokens[0].TokenType == UnifiedShaderTokenType.StringToken &&
                   tokens[0].Text == "pass")
            {
                var pass = new PassInfo();
                ExpectToken(ConsumeToken(tokens), "pass");
                var passName = ConsumeToken(tokens);
                ExpectToken(passName, UnifiedShaderTokenType.StringToken);
                pass.Name = passName.Text;
                ParsePass(pass, tokens);
                technique.Passes.Add(pass);
            }

            info.Techniques.Add(technique);

            ExpectToken(ConsumeToken(tokens), UnifiedShaderTokenType.CloseBrace);
        }