本文整理汇总了C#中Axiom.Graphics.GpuProgramParameters.SetNamedAutoConstant方法的典型用法代码示例。如果您正苦于以下问题:C# GpuProgramParameters.SetNamedAutoConstant方法的具体用法?C# GpuProgramParameters.SetNamedAutoConstant怎么用?C# GpuProgramParameters.SetNamedAutoConstant使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Axiom.Graphics.GpuProgramParameters
的用法示例。
在下文中一共展示了GpuProgramParameters.SetNamedAutoConstant方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TranslateProgramParameters
//.........这里部分代码省略.........
compiler.AddError( CompileErrorCode.InvalidParameters, prop.File, prop.Line,
"name or index and auto constant type expected" );
return;
}
AtomAbstractNode atom0 = (AtomAbstractNode)i0, atom1 = (AtomAbstractNode)i1;
if ( !named && !atom0.IsNumber )
{
compiler.AddError( CompileErrorCode.NumberExpected, prop.File, prop.Line,
"parameter index expected" );
return;
}
if ( named )
name = atom0.Value;
else
index = int.Parse( atom0.Value );
// Look up the auto constant
atom1.Value = atom1.Value.ToLower();
GpuProgramParameters.AutoConstantDefinition def;
bool defFound = GpuProgramParameters.GetAutoConstantDefinition( atom1.Value, out def );
if ( defFound )
{
switch ( def.DataType )
{
#region None
case GpuProgramParameters.AutoConstantDataType.None:
// Set the auto constant
try
{
if ( named )
parameters.SetNamedAutoConstant( name, def.AutoConstantType );
else
parameters.SetAutoConstant( index, def.AutoConstantType );
}
catch
{
compiler.AddError( CompileErrorCode.InvalidParameters, prop.File, prop.Line,
"setting of constant failed" );
}
break;
#endregion None
#region Int
case GpuProgramParameters.AutoConstantDataType.Int:
if ( def.AutoConstantType == GpuProgramParameters.AutoConstantType.AnimationParametric )
{
try
{
if ( named )
parameters.SetNamedAutoConstant( name, def.AutoConstantType, animParametricsCount++ );
else
parameters.SetAutoConstant( index, def.AutoConstantType, animParametricsCount++ );
}
catch
{
compiler.AddError( CompileErrorCode.InvalidParameters, prop.File, prop.Line,
"setting of constant failed" );
}
}
else
{
// Only certain texture projection auto params will assume 0
// Otherwise we will expect that 3rd parameter