本文整理汇总了C#中Axiom.Graphics.GpuProgramParameters.SetNamedConstant方法的典型用法代码示例。如果您正苦于以下问题:C# GpuProgramParameters.SetNamedConstant方法的具体用法?C# GpuProgramParameters.SetNamedConstant怎么用?C# GpuProgramParameters.SetNamedConstant使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Axiom.Graphics.GpuProgramParameters
的用法示例。
在下文中一共展示了GpuProgramParameters.SetNamedConstant方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UpdateCustomGpuParameter
public void UpdateCustomGpuParameter(GpuProgramParameters.AutoConstantEntry constant, GpuProgramParameters parameters)
{
parameters.SetNamedConstant(_scaleFactorName, ScaleFactor);
parameters.SetNamedConstant(_fineBlockOriginName, FineBlockOrigin);
}
示例2: UpdateVpParams
/// <summary>
///
/// </summary>
/// <param name="prof"></param>
/// <param name="terrain"></param>
/// <param name="tt"></param>
/// <param name="gpuparams"></param>
public virtual void UpdateVpParams( SM2Profile prof, Terrain terrain, TechniqueType tt,
GpuProgramParameters gpuparams )
{
gpuparams.IgnoreMissingParameters = true;
uint maxLayers = prof.GetMaxLayers( terrain );
uint numLayers = Utility.Min( maxLayers, (uint)terrain.LayerCount );
uint numUVMul = numLayers/4;
if ( numUVMul%4 == 0 )
{
++numUVMul;
}
for ( uint i = 0; i < numUVMul; ++i )
{
var uvMul = new Vector4( terrain.GetLayerUVMultiplier( (byte)( i*4 ) ),
terrain.GetLayerUVMultiplier( (byte)( i*4 + 1 ) ),
terrain.GetLayerUVMultiplier( (byte)( i*4 + 2 ) ),
terrain.GetLayerUVMultiplier( (byte)( i*4 + 3 ) ) );
#if true
gpuparams.SetNamedConstant( "uvMul" + i.ToString(), uvMul );
#endif
}
}
示例3: UpdateFpParams
/// <summary>
///
/// </summary>
/// <param name="prof"></param>
/// <param name="terrain"></param>
/// <param name="tt"></param>
/// <param name="gpuparams"></param>
public virtual void UpdateFpParams( SM2Profile prof, Terrain terrain, TechniqueType tt,
GpuProgramParameters gpuparams )
{
gpuparams.IgnoreMissingParameters = true;
// TODO - parameterise this?
var scaleBiasSpecular = new Vector4( 0.03f, -0.04f, 32, 1 );
gpuparams.SetNamedConstant( "scaleBiasSpecular", scaleBiasSpecular );
}
示例4: TranslateProgramParameters
public static void TranslateProgramParameters( ScriptCompiler compiler, /*it should be GpuProgramParametersShared*/ GpuProgramParameters parameters, ObjectAbstractNode obj )
{
int animParametricsCount = 0;
foreach ( AbstractNode i in obj.Children )
{
if ( i is PropertyAbstractNode )
{
PropertyAbstractNode prop = (PropertyAbstractNode)i;
LogManager.Instance.Write("TranslateProgramParameters {0}", (Keywords)prop.Id);
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;
}
AbstractNode i0 = getNodeAt( prop.Values, 0 );
if ( !( i0 is AtomAbstractNode ) )
{
compiler.AddError( CompileErrorCode.InvalidParameters, prop.File, prop.Line,
"shared parameter set name expected" );
continue;
}
AtomAbstractNode atom0 = (AtomAbstractNode)i0;
throw new NotImplementedException();
#if UNREACHABLE_CODE
try
{
//TODO
//parameters->addSharedParameters(atom0->value);
}
catch ( AxiomException e )
{
compiler.AddError( CompileErrorCode.InvalidParameters, prop.File, prop.Line, e.Message );
}
}
break;
#else
}
#endif
#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 )
{
bool named = ( prop.Id == (uint)Keywords.ID_PARAM_NAMED );
AbstractNode i0 = getNodeAt( prop.Values, 0 ), i1 = getNodeAt( prop.Values, 1 ),
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;
}
AtomAbstractNode atom0 = (AtomAbstractNode)i0, atom1 = (AtomAbstractNode)i1;
if ( !named && !atom0.IsNumber )
{
compiler.AddError( CompileErrorCode.NumberExpected, prop.File, prop.Line,
"parameter index expected" );
return;
}
string name = string.Empty;
int 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
parameters.SetConstant( index, m );
}
catch
{
compiler.AddError( CompileErrorCode.InvalidParameters, prop.File, prop.Line,
"setting matrix4x4 parameter failed" );
//.........这里部分代码省略.........