本文整理汇总了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)
//.........这里部分代码省略.........