当前位置: 首页>>代码示例>>C#>>正文


C# Command.StripArray方法代码示例

本文整理汇总了C#中Command.StripArray方法的典型用法代码示例。如果您正苦于以下问题:C# Command.StripArray方法的具体用法?C# Command.StripArray怎么用?C# Command.StripArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Command的用法示例。


在下文中一共展示了Command.StripArray方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ProcessCommand

		bool ProcessCommand(ref Command cmd, List<Command> insertBefore)
		{
			bool isSaturated = cmd.name.EndsWith("_sat");

			if (isSaturated)
				cmd.name = cmd.name.Substring(0, cmd.name.Length - 4);

            if (this.platform == TargetPlatform.Xbox360)
            {
                //modify the commands to work with local variables,
                //and deal with asm commands not supported on the xbox

                if (cmd.name.EndsWith("_pp")) // no partial precision on the xbox
                    cmd.name = cmd.name.Substring(0, cmd.name.Length - 3);

                if (cmd.name == "def")
                {
                    //special case, local constants

                    if (cmd.args.Length == 5 &&
                        cmd.args[0][0].Length > 1 &&
                        cmd.args[0][0][0] == 'c')
                    {
                        int index = int.Parse(cmd.args[0][0].Substring(1));

                        string value = cmd.Arg(1) + "," + cmd.Arg(2) + "," + cmd.Arg(3) + "," + cmd.Arg(4);

                        localConstants.Add(index, value);
                        return false;
                    }
                }
                if (cmd.name == "defi")
                {
                    //integer constant variation

                    if (cmd.args.Length == 5 &&
                        cmd.args[0][0].Length > 1 &&
                        cmd.args[0][0][0] == 'i')
                    {
                        int index = int.Parse(cmd.args[0][0].Substring(1));
                        string value = cmd.Arg(1) + "," + cmd.Arg(2) + "," + cmd.Arg(3) + "," + cmd.Arg(4);

                        localIntegerConstants.Add(index, value);
                        return false;
                    }
                }
                if (cmd.name == "defb")
                {
                    //boolean constant variation

                    if (cmd.args.Length == 2 &&
                        cmd.args[0][0].Length > 1 &&
                        cmd.args[0][0][0] == 'b')
                    {
                        int index = int.Parse(cmd.args[0][0].Substring(1));
                        string value = cmd.Arg(1);

                        localBooleanConstants.Add(index, value);
                        return false;
                    }
                }

                for (int i = 0; i < cmd.args.Length; i++)
                {
                    int firstIndex = 0;
                    for (int a = 0; a < cmd.args[i].Length; a++)
                    {
                        //some command inputs specify absolute value, which is a bit tricky here
                        string arg = cmd.args[i][a];

                        if (arg == "-")
                            firstIndex = 1;

                        if (a == firstIndex && arg.Length > 0 && char.IsNumber(arg[0]) == false)
                        {
                            if (arg.EndsWith("_abs"))
                            {
                                arg = arg.Substring(0, arg.Length - 4);

                                insertBefore.Add(new Command("_tmp = (float4)abs(_{0});", arg));

                                arg = "tmp";
                                useTemp = true;
                            }

                            string indexer = cmd.ArrayIndex(i);
                            ExtractArg(ref arg, indexer);
                            if (indexer != null)
                                cmd.StripArray(i);

                            arg = "_" + arg;
                        }

                        cmd.args[i][a] = arg;
                    }
                }

                //These are the commands that do not exist in Xbox assembly (XPS / XVS)
                //They may have equivalents, however for the most part, their HLSL version is used.
                switch (cmd.name)
//.........这里部分代码省略.........
开发者ID:shadarath,项目名称:Wirtualna-rzeczywistosc,代码行数:101,代码来源:AsmToHlslAsmConverter.cs


注:本文中的Command.StripArray方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。