当前位置: 首页>>代码示例>>C#>>正文


C# Function.ResolveLocalParameter方法代码示例

本文整理汇总了C#中Function.ResolveLocalParameter方法的典型用法代码示例。如果您正苦于以下问题:C# Function.ResolveLocalParameter方法的具体用法?C# Function.ResolveLocalParameter怎么用?C# Function.ResolveLocalParameter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Function的用法示例。


在下文中一共展示了Function.ResolveLocalParameter方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AddPSFunctionInvocations

		private bool AddPSFunctionInvocations( TextureUnitParams textureUnitParams, Function psMain,
		                                       ref int internalCounter )
		{
			LayerBlendModeEx colorBlend = textureUnitParams.TextureUnitState.ColorBlendMode;
			LayerBlendModeEx alphaBlend = textureUnitParams.TextureUnitState.AlphaBlendMode;
			Parameter source1;
			Parameter source2;
			var groupOrder = (int)FFPRenderState.FFPFragmentShaderStage.PSTexturing;

			//Add texture sampling code
			Parameter texel = psMain.ResolveLocalParameter( Parameter.SemanticType.Unknown, 0,
			                                                "texel_" + textureUnitParams.TextureSamplerIndex.ToString(),
			                                                GpuProgramParameters.GpuConstantType.Float4 );
			AddPSSampleTexelInvocation( textureUnitParams, psMain, texel, groupOrder, ref internalCounter );

			//Build color argument for source1
			source1 = psMain.ResolveLocalParameter( Parameter.SemanticType.Unknown, 0, "source1",
			                                        GpuProgramParameters.GpuConstantType.Float4 );

			AddPSArgumentInvocations( psMain, source1, texel, textureUnitParams.TextureSamplerIndex, colorBlend.source1,
			                          colorBlend.colorArg1, colorBlend.alphaArg1, false, groupOrder, ref internalCounter );

			//build color argument for source2
			source2 = psMain.ResolveLocalParameter( Parameter.SemanticType.Unknown, 0, "source2",
			                                        GpuProgramParameters.GpuConstantType.Float4 );

			AddPSArgumentInvocations( psMain, source2, texel, textureUnitParams.TextureSamplerIndex, colorBlend.source2,
			                          colorBlend.colorArg2, colorBlend.alphaArg2, false, groupOrder, ref internalCounter );

			bool needDifferentAlphaBlend = false;
			if ( alphaBlend.operation != colorBlend.operation ||
			     alphaBlend.source1 != colorBlend.source1 ||
			     alphaBlend.source2 != colorBlend.source2 ||
			     colorBlend.source1 == LayerBlendSource.Manual ||
			     colorBlend.source2 == LayerBlendSource.Manual ||
			     alphaBlend.source1 == LayerBlendSource.Manual ||
			     alphaBlend.source2 == LayerBlendSource.Manual )
			{
				needDifferentAlphaBlend = true;
			}

			//Build colors blend
			AddPSBlendInvocations( psMain, source1, source2, texel, textureUnitParams.TextureSamplerIndex, colorBlend,
			                       groupOrder, ref internalCounter,
			                       needDifferentAlphaBlend
			                       	? (int)( Operand.OpMask.X | Operand.OpMask.Y | Operand.OpMask.Z )
			                       	: (int)( Operand.OpMask.All ) );

			//Case we need different alpha channel code
			if ( needDifferentAlphaBlend )
			{
				//build alpha argument for source1
				AddPSArgumentInvocations( psMain, source1, texel, textureUnitParams.TextureSamplerIndex,
				                          alphaBlend.source1, alphaBlend.colorArg1, alphaBlend.alphaArg1, true,
				                          groupOrder, ref internalCounter );

				//Build alpha argument for source2
				AddPSArgumentInvocations( psMain, source2, texel, textureUnitParams.TextureSamplerIndex,
				                          alphaBlend.source2, alphaBlend.colorArg2, alphaBlend.alphaArg2, true,
				                          groupOrder, ref internalCounter );

				//Build alpha blend
				AddPSBlendInvocations( psMain, source1, source2, texel, textureUnitParams.TextureSamplerIndex,
				                       alphaBlend, groupOrder, ref internalCounter, (int)Operand.OpMask.W );
			}

			return true;
		}
开发者ID:ryan-bunker,项目名称:axiom3d,代码行数:68,代码来源:FFPTexturing.cs


注:本文中的Function.ResolveLocalParameter方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。