本文整理汇总了C#中Axiom.Graphics.GpuProgramParameters.SetAutoConstant方法的典型用法代码示例。如果您正苦于以下问题:C# GpuProgramParameters.SetAutoConstant方法的具体用法?C# GpuProgramParameters.SetAutoConstant怎么用?C# GpuProgramParameters.SetAutoConstant使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Axiom.Graphics.GpuProgramParameters
的用法示例。
在下文中一共展示了GpuProgramParameters.SetAutoConstant方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Clone
public GpuProgramParameters Clone()
{
GpuProgramParameters p = new GpuProgramParameters();
// copy int constants
for ( int i = 0; i < intConstants.Count; i++ )
{
IntConstantEntry e = intConstants[ i ] as IntConstantEntry;
if ( e.isSet )
{
p.SetConstant( i, e.val );
}
}
// copy float constants
for ( int i = 0; i < floatConstants.Count; i++ )
{
FloatConstantEntry e = floatConstants[ i ] as FloatConstantEntry;
if ( e.isSet )
{
p.SetConstant( i, e.val );
}
}
// copy auto constants
for ( int i = 0; i < autoConstantList.Count; i++ )
{
AutoConstantEntry entry = autoConstantList[ i ] as AutoConstantEntry;
p.SetAutoConstant( entry.Clone() );
}
// copy named params
foreach ( string key in namedParams.Keys )
{
p.MapParamNameToIndex( key, namedParams[ key ] );
}
for ( int i = 0; i < paramTypeList.Count; i++ )
{
}
foreach ( ParameterEntry pEntry in paramTypeList )
{
p.AddParameterToDefaultsList( pEntry.ParameterType, pEntry.ParameterName );
}
// copy value members
p.transposeMatrices = transposeMatrices;
p.autoAddParamName = autoAddParamName;
return p;
}
示例2: TranslateProgramParameters
//.........这里部分代码省略.........
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
if ( i2 == null )
{
示例3: InitShadowDebugPass
private void InitShadowDebugPass()
{
Material matDebug = MaterialManager.Instance.GetByName(SHADOW_VOLUMES_MATERIAL);
if(matDebug == null) {
// Create
matDebug = (Material)MaterialManager.Instance.Create(SHADOW_VOLUMES_MATERIAL);
shadowDebugPass = matDebug.GetTechnique(0).GetPass(0);
shadowDebugPass.SetSceneBlending(SceneBlendType.Add);
shadowDebugPass.LightingEnabled = false;
shadowDebugPass.DepthWrite = false;
TextureUnitState t = shadowDebugPass.CreateTextureUnitState();
t.SetColorOperationEx(
LayerBlendOperationEx.Modulate,
LayerBlendSource.Manual,
LayerBlendSource.Current,
new ColorEx(0.7f, 0.0f, 0.2f));
shadowDebugPass.CullMode = CullingMode.None;
if(targetRenderSystem.Caps.CheckCap(Capabilities.VertexPrograms)) {
ShadowVolumeExtrudeProgram.Initialize();
// Enable the (infinite) point light extruder for now, just to get some params
shadowDebugPass.SetVertexProgram(
ShadowVolumeExtrudeProgram.GetProgramName(ShadowVolumeExtrudeProgram.Programs.PointLight));
infiniteExtrusionParams = shadowDebugPass.VertexProgramParameters;
infiniteExtrusionParams.SetAutoConstant(0, AutoConstants.WorldViewProjMatrix);
infiniteExtrusionParams.SetAutoConstant(4, AutoConstants.LightPositionObjectSpace);
}
matDebug.Compile();
}
else {
shadowDebugPass = matDebug.GetTechnique(0).GetPass(0);
}
}
示例4: InitShadowStencilPass
private void InitShadowStencilPass()
{
Material matStencil = MaterialManager.Instance.GetByName(STENCIL_SHADOW_VOLUMES_MATERIAL);
if(matStencil == null) {
// Create
matStencil = (Material)MaterialManager.Instance.Create(STENCIL_SHADOW_VOLUMES_MATERIAL);
shadowStencilPass = matStencil.GetTechnique(0).GetPass(0);
if(targetRenderSystem.Caps.CheckCap(Capabilities.VertexPrograms)) {
// Enable the finite point light extruder for now, just to get some params
shadowStencilPass.SetVertexProgram(
ShadowVolumeExtrudeProgram.GetProgramName(ShadowVolumeExtrudeProgram.Programs.PointLightFinite));
finiteExtrusionParams = shadowStencilPass.VertexProgramParameters;
finiteExtrusionParams.SetAutoConstant(0, AutoConstants.WorldViewProjMatrix);
finiteExtrusionParams.SetAutoConstant(4, AutoConstants.LightPositionObjectSpace);
finiteExtrusionParams.SetAutoConstant(5, AutoConstants.ShadowExtrusionDistance);
}
matStencil.Compile();
// Nothing else, we don't use this like a 'real' pass anyway,
// it's more of a placeholder
}
else {
shadowStencilPass = matStencil.GetTechnique(0).GetPass(0);
}
}
示例5: Clone
public GpuProgramParameters Clone()
{
GpuProgramParameters p = new GpuProgramParameters();
// copy int constants
for ( int i = 0; i < intConstants.Count; i++ )
{
IntConstantEntry e = intConstants[i];
if ( e.isSet )
{
p.SetConstant(i, e.val);
}
}
// copy float constants
p.floatConstantsArray = new float[floatConstantsArray.Length];
Array.Copy(floatConstantsArray, p.floatConstantsArray, floatConstantsArray.Length);
p.floatIsSet = new bool[floatIsSet.Length];
Array.Copy(floatIsSet, p.floatIsSet, floatIsSet.Length);
p.float4VecConstantsCount = float4VecConstantsCount;
p.maxSetCount = maxSetCount;
// copy auto constants
for(int i = 0; i < autoConstantList.Count; i++)
{
AutoConstantEntry entry = autoConstantList[i];
p.SetAutoConstant(entry.Clone());
}
// copy named params
foreach ( DictionaryEntry e in namedParams )
{
p.MapParamNameToIndex(e.Key as string, (int)e.Value);
}
for ( int i = 0; i < paramTypeList.Count; i++ )
{
}
foreach ( ParameterEntry pEntry in paramTypeList )
{
p.AddParameterToDefaultsList(pEntry.ParameterType, pEntry.ParameterName);
}
// copy value members
p.transposeMatrices = transposeMatrices;
p.autoAddParamName = autoAddParamName;
return p;
}