本文整理汇总了C#中Axiom.Graphics.GpuProgramParameters.AddSharedParameters方法的典型用法代码示例。如果您正苦于以下问题:C# GpuProgramParameters.AddSharedParameters方法的具体用法?C# GpuProgramParameters.AddSharedParameters怎么用?C# GpuProgramParameters.AddSharedParameters使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Axiom.Graphics.GpuProgramParameters
的用法示例。
在下文中一共展示了GpuProgramParameters.AddSharedParameters方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TranslateProgramParameters
public static void TranslateProgramParameters( ScriptCompiler compiler, GpuProgramParameters parameters,
ObjectAbstractNode obj )
{
var animParametricsCount = 0;
foreach ( var i in obj.Children )
{
if ( !( i is PropertyAbstractNode ) )
{
continue;
}
var prop = (PropertyAbstractNode)i;
switch ( (Keywords)prop.Id )
{
#region ID_SHARED_PARAMS_REF
case Keywords.ID_SHARED_PARAMS_REF:
{
if ( prop.Values.Count != 1 )
{
compiler.AddError( CompileErrorCode.InvalidParameters, prop.File, prop.Line,
"shared_params_ref requires a single parameter" );
continue;
}
var i0 = getNodeAt( prop.Values, 0 );
if ( !( i0 is AtomAbstractNode ) )
{
compiler.AddError( CompileErrorCode.InvalidParameters, prop.File, prop.Line,
"shared parameter set name expected" );
continue;
}
var atom0 = (AtomAbstractNode)i0;
try
{
parameters.AddSharedParameters( atom0.Value );
}
catch ( AxiomException e )
{
compiler.AddError( CompileErrorCode.InvalidParameters, prop.File, prop.Line, e.Message );
}
}
break;
#endregion ID_SHARED_PARAMS_REF
#region ID_PARAM_INDEXED || ID_PARAM_NAMED
case Keywords.ID_PARAM_INDEXED:
case Keywords.ID_PARAM_NAMED:
{
if ( prop.Values.Count >= 3 )
{
var named = ( prop.Id == (uint)Keywords.ID_PARAM_NAMED );
var i0 = getNodeAt( prop.Values, 0 );
var i1 = getNodeAt( prop.Values, 1 );
var k = getNodeAt( prop.Values, 2 );
if ( !( i0 is AtomAbstractNode ) || !( i1 is AtomAbstractNode ) )
{
compiler.AddError( CompileErrorCode.InvalidParameters, prop.File, prop.Line,
"name or index and parameter type expected" );
return;
}
var atom0 = (AtomAbstractNode)i0;
var atom1 = (AtomAbstractNode)i1;
if ( !named && !atom0.IsNumber )
{
compiler.AddError( CompileErrorCode.NumberExpected, prop.File, prop.Line, "parameter index expected" );
return;
}
var name = string.Empty;
var index = 0;
// Assign the name/index
if ( named )
{
name = atom0.Value;
}
else
{
index = (int)atom0.Number;
}
// Determine the type
if ( atom1.Value == "matrix4x4" )
{
Matrix4 m;
if ( getMatrix4( prop.Values, 2, out m ) )
{
try
{
if ( named )
{
parameters.SetNamedConstant( name, m );
}
else
//.........这里部分代码省略.........