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


C# Function.AddAtomInstance方法代码示例

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


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

示例1: AddPSFinalAssignmentInvocation

		protected bool AddPSFinalAssignmentInvocation( Function psMain, int groupOrder, ref int internalCounter )
		{
			var curFuncInvocation = new FunctionInvocation( FFPRenderState.FFPFuncAssign,
			                                                (int)FFPRenderState.FFPFragmentShaderStage.PSColorBegin + 1,
			                                                internalCounter++ );
			curFuncInvocation.PushOperand( this.psTempDiffuseColor, Operand.OpSemantic.In );
			curFuncInvocation.PushOperand( this.psDiffuse, Operand.OpSemantic.Out );
			psMain.AddAtomInstance( curFuncInvocation );

			curFuncInvocation = new FunctionInvocation( FFPRenderState.FFPFuncAssign,
			                                            (int)FFPRenderState.FFPFragmentShaderStage.PSColorBegin + 1,
			                                            internalCounter++ );
			curFuncInvocation.PushOperand( this.psDiffuse, Operand.OpSemantic.In );
			curFuncInvocation.PushOperand( this.psOutDiffuse, Operand.OpSemantic.Out );
			psMain.AddAtomInstance( curFuncInvocation );

			if ( this.specularEnable )
			{
				curFuncInvocation = new FunctionInvocation( FFPRenderState.FFPFuncAssign,
				                                            (int)FFPRenderState.FFPFragmentShaderStage.PSColorBegin + 1,
				                                            internalCounter++ );
				curFuncInvocation.PushOperand( this.psTempSpecularColor, Operand.OpSemantic.In );
				curFuncInvocation.PushOperand( this.psSpecular, Operand.OpSemantic.Out );
				psMain.AddAtomInstance( curFuncInvocation );
			}
			return true;
		}
开发者ID:ryan-bunker,项目名称:axiom3d,代码行数:27,代码来源:PerPixelLighting.cs

示例2: AddPSGlobalIlluminationInvocation

		private bool AddPSGlobalIlluminationInvocation( Function psMain, int groupOrder, ref int internalCounter )
		{
			FunctionInvocation curFuncInvocation = null;
			if ( ( this.trackVertexColorType & TrackVertexColor.Ambient ) == 0 &&
			     ( this.trackVertexColorType & TrackVertexColor.Emissive ) == 0 )
			{
				curFuncInvocation = new FunctionInvocation( FFPRenderState.FFPFuncAssign, groupOrder, internalCounter++ );
				curFuncInvocation.PushOperand( this.derivedSceneColor, Operand.OpSemantic.In );
				curFuncInvocation.PushOperand( this.psTempDiffuseColor, Operand.OpSemantic.Out );
				psMain.AddAtomInstance( curFuncInvocation );
			}
			else
			{
				if ( ( this.trackVertexColorType & TrackVertexColor.Ambient ) != 0 )
				{
					curFuncInvocation = new FunctionInvocation( FFPRenderState.FFPFuncModulate, groupOrder,
					                                            internalCounter++ );
					curFuncInvocation.PushOperand( this.lightAmbientColor, Operand.OpSemantic.In );
					curFuncInvocation.PushOperand( this.psDiffuse, Operand.OpSemantic.In );
					curFuncInvocation.PushOperand( this.psTempDiffuseColor, Operand.OpSemantic.Out );
					psMain.AddAtomInstance( curFuncInvocation );
				}
				else
				{
					curFuncInvocation = new FunctionInvocation( FFPRenderState.FFPFuncAssign, groupOrder,
					                                            internalCounter++ );
					curFuncInvocation.PushOperand( this.derivedAmbientLightColor, Operand.OpSemantic.In,
					                               (int)( Operand.OpMask.X | Operand.OpMask.Y | Operand.OpMask.Z ) );
					curFuncInvocation.PushOperand( this.psTempDiffuseColor, Operand.OpSemantic.Out,
					                               (int)( Operand.OpMask.X | Operand.OpMask.Y | Operand.OpMask.Z ) );
					psMain.AddAtomInstance( curFuncInvocation );
				}

				if ( ( this.trackVertexColorType & TrackVertexColor.Emissive ) != 0 )
				{
					curFuncInvocation = new FunctionInvocation( FFPRenderState.FFPFuncAdd, groupOrder, internalCounter++ );
					curFuncInvocation.PushOperand( this.psDiffuse, Operand.OpSemantic.In );
					curFuncInvocation.PushOperand( this.psTempDiffuseColor, Operand.OpSemantic.In );
					curFuncInvocation.PushOperand( this.psTempDiffuseColor, Operand.OpSemantic.Out );
					psMain.AddAtomInstance( curFuncInvocation );
				}
				else
				{
					curFuncInvocation = new FunctionInvocation( FFPRenderState.FFPFuncAdd, groupOrder, internalCounter++ );
					curFuncInvocation.PushOperand( this.surfaceEmissiveColor, Operand.OpSemantic.In );
					curFuncInvocation.PushOperand( this.psTempDiffuseColor, Operand.OpSemantic.In );
					curFuncInvocation.PushOperand( this.psTempDiffuseColor, Operand.OpSemantic.Out );
					psMain.AddAtomInstance( curFuncInvocation );
				}
			}

			if ( this.specularEnable )
			{
				curFuncInvocation = new FunctionInvocation( FFPRenderState.FFPFuncAssign, groupOrder, internalCounter++ );
				curFuncInvocation.PushOperand( this.psSpecular, Operand.OpSemantic.In );
				curFuncInvocation.PushOperand( this.psTempSpecularColor, Operand.OpSemantic.Out );
				psMain.AddAtomInstance( curFuncInvocation );
			}

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

示例3: AddIndexedNormalRelatedWeight

		private void AddIndexedNormalRelatedWeight( Function vsMain, Parameter normalRelatedParam,
		                                            Parameter normalWorldRelatedParam, int index, ref int funcCounter )
		{
			FunctionInvocation curFuncInvocation;
			Operand.OpMask indexMask = IndexToMask( index );

			//multiply position with world matrix and put into temporary param
			curFuncInvocation = new FunctionInvocation( FFPRenderState.FFPFuncTransform,
			                                            (int)FFPRenderState.FFPVertexShaderStage.VSTransform,
			                                            funcCounter++ );
			curFuncInvocation.PushOperand( paramInWorldMatrices, Operand.OpSemantic.In, (int)Operand.OpMask.All );
			curFuncInvocation.PushOperand( paramInIndices, Operand.OpSemantic.In, (int)indexMask, 1 );
			curFuncInvocation.PushOperand( normalRelatedParam, Operand.OpSemantic.In );
			curFuncInvocation.PushOperand( paramTempFloat3, Operand.OpSemantic.Out );
			vsMain.AddAtomInstance( curFuncInvocation );

			//multiply temporary param with weight
			curFuncInvocation = new FunctionInvocation( FFPRenderState.FFPFuncModulate,
			                                            (int)FFPRenderState.FFPVertexShaderStage.VSTransform,
			                                            funcCounter++ );
			curFuncInvocation.PushOperand( paramTempFloat3, Operand.OpSemantic.In );
			curFuncInvocation.PushOperand( paramInWeights, Operand.OpSemantic.In, (int)indexMask );
			curFuncInvocation.PushOperand( paramTempFloat3, Operand.OpSemantic.Out );
			vsMain.AddAtomInstance( curFuncInvocation );

			//check if on first iteration
			if ( index == 0 )
			{
				//set the local param as the value of the world normal
				curFuncInvocation = new FunctionInvocation( FFPRenderState.FFPFuncAssign,
				                                            (int)FFPRenderState.FFPVertexShaderStage.VSTransform,
				                                            funcCounter++ );
				curFuncInvocation.PushOperand( paramTempFloat3, Operand.OpSemantic.In );
				curFuncInvocation.PushOperand( normalWorldRelatedParam, Operand.OpSemantic.In );
				curFuncInvocation.PushOperand( normalWorldRelatedParam, Operand.OpSemantic.Out );
				vsMain.AddAtomInstance( curFuncInvocation );
			}
			else
			{
				//add the local param as the value of the world normal
				curFuncInvocation = new FunctionInvocation( FFPRenderState.FFPFuncAdd,
				                                            (int)FFPRenderState.FFPVertexShaderStage.VSTransform,
				                                            funcCounter++ );
				curFuncInvocation.PushOperand( paramTempFloat3, Operand.OpSemantic.In );
				curFuncInvocation.PushOperand( normalWorldRelatedParam, Operand.OpSemantic.In );
				curFuncInvocation.PushOperand( normalWorldRelatedParam, Operand.OpSemantic.Out );
				vsMain.AddAtomInstance( curFuncInvocation );
			}
		}
开发者ID:ryan-bunker,项目名称:axiom3d,代码行数:49,代码来源:LinearSkinning.cs

示例4: AddVSInvocation

		private bool AddVSInvocation( Function vsMain, int groupOrder, ref int internalCounter )
		{
			FunctionInvocation curFuncInvocation;

			//Output the vertex depth in camera space
			curFuncInvocation = new FunctionInvocation( FFPRenderState.FFPFuncAssign, groupOrder, internalCounter++ );
			curFuncInvocation.PushOperand( this.vsOutPos, Operand.OpSemantic.In, Operand.OpMask.Z );
			curFuncInvocation.PushOperand( this.vsOutDepth, Operand.OpSemantic.Out );
			vsMain.AddAtomInstance( curFuncInvocation );

			//compute world space position
			foreach ( var it in this.shadowTextureParamsList )
			{
				curFuncInvocation = new FunctionInvocation( FFPRenderState.FFPFuncTransform, groupOrder,
				                                            internalCounter++ );
				curFuncInvocation.PushOperand( it.WorldViewProjMatrix, Operand.OpSemantic.In );
				curFuncInvocation.PushOperand( this.vsInPos, Operand.OpSemantic.In );
				curFuncInvocation.PushOperand( it.VSOutLightPosition, Operand.OpSemantic.Out );
				vsMain.AddAtomInstance( curFuncInvocation );
			}
			return true;
		}
开发者ID:ryan-bunker,项目名称:axiom3d,代码行数:22,代码来源:IntegratedPSSM3.cs

示例5: AddPSSampleTexelInvocation

		protected virtual void AddPSSampleTexelInvocation( TextureUnitParams textureUnitParams, Function psMain,
		                                                   Parameter texel, int groupOrder, ref int internalCounter )
		{
			FunctionInvocation curFuncInvocation = null;
			if ( textureUnitParams.TexCoordCalcMethod == TexCoordCalcMethod.ProjectiveTexture )
			{
				curFuncInvocation = new FunctionInvocation( FFPRenderState.FFPFuncSamplerTextureProj, groupOrder,
				                                            internalCounter++ );
			}
			else
			{
				curFuncInvocation = new FunctionInvocation( FFPRenderState.FFPFuncSampleTexture, groupOrder,
				                                            internalCounter++ );
			}

			curFuncInvocation.PushOperand( textureUnitParams.TextureSampler, Operand.OpSemantic.In );
			curFuncInvocation.PushOperand( textureUnitParams.PSInputTexCoord, Operand.OpSemantic.In );
			curFuncInvocation.PushOperand( texel, Operand.OpSemantic.Out );
			psMain.AddAtomInstance( curFuncInvocation );
		}
开发者ID:ryan-bunker,项目名称:axiom3d,代码行数:20,代码来源:FFPTexturing.cs

示例6: AddNormalRelatedCalculations

		private void AddNormalRelatedCalculations( Function vsMain, Parameter normalRelatedParam,
		                                           Parameter normalWorldRelatedParam, ref int funcCounter )
		{
			FunctionInvocation curFuncInvocation;

			if ( doBoneCalculations )
			{
				//set functions to calculate world normal
				for ( int i = 0; i < weightCount; i++ )
				{
					AddIndexedNormalRelatedWeight( vsMain, normalRelatedParam, normalWorldRelatedParam, i,
					                               ref funcCounter );
				}

				//update back the original position relative to the object
				curFuncInvocation = new FunctionInvocation( FFPRenderState.FFPFuncTransform,
				                                            (int)FFPRenderState.FFPVertexShaderStage.VSTransform,
				                                            funcCounter++ );
				curFuncInvocation.PushOperand( paramInInvWorldMatrix, Operand.OpSemantic.In );
				curFuncInvocation.PushOperand( normalWorldRelatedParam, Operand.OpSemantic.In );
				curFuncInvocation.PushOperand( normalRelatedParam, Operand.OpSemantic.Out );
				vsMain.AddAtomInstance( curFuncInvocation );
			}
			else
			{
				//update back the original position relative to the object
				curFuncInvocation = new FunctionInvocation( FFPRenderState.FFPFuncTransform,
				                                            (int)FFPRenderState.FFPVertexShaderStage.VSTransform,
				                                            funcCounter++ );
				curFuncInvocation.PushOperand( paramInWorldMatrix, Operand.OpSemantic.In );
				curFuncInvocation.PushOperand( normalRelatedParam, Operand.OpSemantic.In );
				curFuncInvocation.PushOperand( normalWorldRelatedParam, Operand.OpSemantic.Out );
				vsMain.AddAtomInstance( curFuncInvocation );
			}
		}
开发者ID:ryan-bunker,项目名称:axiom3d,代码行数:35,代码来源:LinearSkinning.cs

示例7: AddIndexedPositionWeight

		private void AddIndexedPositionWeight( Function vsMain, int index, Parameter worldMatrix,
		                                       Parameter positionTempParameter, Parameter positionRelatedOutputParam,
		                                       ref int funcCounter )
		{
			Operand.OpMask indexMask = IndexToMask( index );
			FunctionInvocation curFuncInvocation = null;

			//multiply position with world matrix and put into temporary param
			curFuncInvocation = new FunctionInvocation( SGXFuncBlendWeight,
			                                            (int)FFPRenderState.FFPVertexShaderStage.VSTransform,
			                                            funcCounter++ );
			curFuncInvocation.PushOperand( paramInWeights, Operand.OpSemantic.In, indexMask );
			curFuncInvocation.PushOperand( worldMatrix, Operand.OpSemantic.In );
			curFuncInvocation.PushOperand( positionTempParameter, Operand.OpSemantic.Out );
			vsMain.AddAtomInstance( curFuncInvocation );

			//check if on first iteration
			if ( index == 0 )
			{
				//set the local param as the value of the world param
				curFuncInvocation = new FunctionInvocation( FFPRenderState.FFPFuncAssign,
				                                            (int)FFPRenderState.FFPVertexShaderStage.VSTransform,
				                                            funcCounter++ );
				curFuncInvocation.PushOperand( positionTempParameter, Operand.OpSemantic.In );
				curFuncInvocation.PushOperand( positionRelatedOutputParam, Operand.OpSemantic.Out );
				vsMain.AddAtomInstance( curFuncInvocation );
			}
			else
			{
				//add the local param as the value of the world param
				curFuncInvocation = new FunctionInvocation( FFPRenderState.FFPFuncAdd,
				                                            (int)FFPRenderState.FFPVertexShaderStage.VSTransform,
				                                            funcCounter++ );
				curFuncInvocation.PushOperand( positionTempParameter, Operand.OpSemantic.In );
				curFuncInvocation.PushOperand( positionRelatedOutputParam, Operand.OpSemantic.In );
				curFuncInvocation.PushOperand( positionRelatedOutputParam, Operand.OpSemantic.Out );
				vsMain.AddAtomInstance( curFuncInvocation );
			}
		}
开发者ID:ryan-bunker,项目名称:axiom3d,代码行数:39,代码来源:DualQuaternionSkinning.cs

示例8: AddPSBlendInvocations

		protected override void AddPSBlendInvocations( Function psMain, Parameter arg1, Parameter arg2, Parameter texel,
		                                               int samplerIndex, Graphics.LayerBlendModeEx blendMode,
		                                               int groupOrder, ref int internalCounter, int targetChannels )
		{
			//Add the modifier invocation

			AddPSModifierInvocation( psMain, samplerIndex, arg1, arg2, groupOrder, ref internalCounter, targetChannels );

			//Add the blending fucntion invocations
			BlendMode mode = GetBlendMode( samplerIndex );

			if ( ( mode == BlendMode.FFPBlend ) || ( mode == BlendMode.Invalid ) )
			{
				base.AddPSBlendInvocations( psMain, arg1, arg2, texel, samplerIndex, blendMode, groupOrder,
				                            ref internalCounter, targetChannels );
			}
			else
			{
				//find the function name for the blend mode
				string funcName = string.Empty;

				for ( int i = 0; i < blendModes.Length; i++ )
				{
					if ( blendModes[ i ].Type == mode )
					{
						funcName = blendModes[ i ].FuncName;
						break;
					}
				}

				if ( funcName != string.Empty )
				{
					var curFuncInvocation = new FunctionInvocation( funcName, groupOrder, internalCounter++ );
					curFuncInvocation.PushOperand( arg1, Operand.OpSemantic.In, targetChannels );
					curFuncInvocation.PushOperand( arg2, Operand.OpSemantic.In, targetChannels );
					curFuncInvocation.PushOperand( psOutDiffuse, Operand.OpSemantic.Out, targetChannels );
					psMain.AddAtomInstance( curFuncInvocation );
				}
			}
		}
开发者ID:ryan-bunker,项目名称:axiom3d,代码行数:40,代码来源:LayeredBlending.cs

示例9: AddNormalRelatedCalculations

		private void AddNormalRelatedCalculations( Function vsMain, Parameter normalRelatedParam,
		                                           Parameter normalWorldRelatedParam, ref int funcCounter )
		{
			FunctionInvocation curFuncInvocation = null;

			if ( doBoneCalculations )
			{
				if ( scalingShearingSupport )
				{
					//Calculate the adjoint transpose of the blended scaling and shearing matrix
					curFuncInvocation = new FunctionInvocation( DualQuaternionSkinning.SGXFuncAdjointTransposeMatrix,
					                                            (int)FFPRenderState.FFPVertexShaderStage.VSTransform,
					                                            funcCounter++ );
					curFuncInvocation.PushOperand( this.paramBlendS, Operand.OpSemantic.In );
					curFuncInvocation.PushOperand( this.paramTempFloat3x3, Operand.OpSemantic.Out );
					vsMain.AddAtomInstance( curFuncInvocation );

					//Transform the normal by the adjoint transpose of the blended scaling and shearing matrix
					curFuncInvocation = new FunctionInvocation( FFPRenderState.FFPFuncTransform,
					                                            (int)FFPRenderState.FFPVertexShaderStage.VSTransform,
					                                            funcCounter++ );
					curFuncInvocation.PushOperand( this.paramTempFloat3x3, Operand.OpSemantic.In );
					curFuncInvocation.PushOperand( normalRelatedParam, Operand.OpSemantic.In );
					curFuncInvocation.PushOperand( normalRelatedParam, Operand.OpSemantic.Out );
					vsMain.AddAtomInstance( curFuncInvocation );

					//Need to normalize again after transforming the normal
					curFuncInvocation = new FunctionInvocation( FFPRenderState.FFPFuncNormalize,
					                                            (int)FFPRenderState.FFPVertexShaderStage.VSTransform,
					                                            funcCounter++ );
					curFuncInvocation.PushOperand( normalRelatedParam, Operand.OpSemantic.InOut );
					vsMain.AddAtomInstance( curFuncInvocation );
				}

				//Transform the normal according to the dual quaternion
				curFuncInvocation = new FunctionInvocation( DualQuaternionSkinning.SGXFuncCalculateBlendNormal,
				                                            (int)FFPRenderState.FFPVertexShaderStage.VSTransform,
				                                            funcCounter++ );
				curFuncInvocation.PushOperand( normalRelatedParam, Operand.OpSemantic.In );
				curFuncInvocation.PushOperand( this.paramBlendDQ, Operand.OpSemantic.In );
				curFuncInvocation.PushOperand( normalWorldRelatedParam, Operand.OpSemantic.Out );
				vsMain.AddAtomInstance( curFuncInvocation );

				//update back the original position relative to the object
				curFuncInvocation = new FunctionInvocation( FFPRenderState.FFPFuncTransform,
				                                            (int)FFPRenderState.FFPVertexShaderStage.VSTransform,
				                                            funcCounter++ );
				curFuncInvocation.PushOperand( paramInInvWorldMatrix, Operand.OpSemantic.In );
				curFuncInvocation.PushOperand( normalWorldRelatedParam, Operand.OpSemantic.In );
				curFuncInvocation.PushOperand( normalRelatedParam, Operand.OpSemantic.Out );
				vsMain.AddAtomInstance( curFuncInvocation );
			}
			else
			{
				//update from object to world space
				curFuncInvocation = new FunctionInvocation( FFPRenderState.FFPFuncTransform,
				                                            (int)FFPRenderState.FFPVertexShaderStage.VSTransform,
				                                            funcCounter++ );
				curFuncInvocation.PushOperand( paramInWorldMatrix, Operand.OpSemantic.In );
				curFuncInvocation.PushOperand( normalRelatedParam, Operand.OpSemantic.In );
				curFuncInvocation.PushOperand( normalWorldRelatedParam, Operand.OpSemantic.Out );
				vsMain.AddAtomInstance( curFuncInvocation );
			}
		}
开发者ID:ryan-bunker,项目名称:axiom3d,代码行数:64,代码来源:DualQuaternionSkinning.cs

示例10: AdjustForCorrectAntipodality

		private void AdjustForCorrectAntipodality( Function vsMain, int index, ref int funcCounter,
		                                           Parameter tempWorldMatrix )
		{
			FunctionInvocation curFuncInvocation = null;
			//Antipodality doesn't need to be adjusted for dq0 on itself (used as the basis of antipodality calculations)
			if ( index > 0 )
			{
				curFuncInvocation = new FunctionInvocation( SGXFuncAntipodalityAdjustment,
				                                            (int)FFPRenderState.FFPVertexShaderStage.VSTransform,
				                                            funcCounter++ );
				//This is the base dual quaternion dq0, which the antipodality calculations are based on
				curFuncInvocation.PushOperand( this.paramInitialDQ, Operand.OpSemantic.In );
				curFuncInvocation.PushOperand( this.paramTempFloat2x4, Operand.OpSemantic.In );
				curFuncInvocation.PushOperand( tempWorldMatrix, Operand.OpSemantic.Out );
				vsMain.AddAtomInstance( curFuncInvocation );
			}
			else if ( index == 0 )
			{
				//Set the first dual quaternion as the initial dq
				curFuncInvocation = new FunctionInvocation( FFPRenderState.FFPFuncAssign,
				                                            (int)FFPRenderState.FFPVertexShaderStage.VSTransform,
				                                            funcCounter++ );
				curFuncInvocation.PushOperand( this.paramTempFloat2x4, Operand.OpSemantic.In );
				curFuncInvocation.PushOperand( this.paramInitialDQ, Operand.OpSemantic.Out );
				vsMain.AddAtomInstance( curFuncInvocation );
			}
		}
开发者ID:ryan-bunker,项目名称:axiom3d,代码行数:27,代码来源:DualQuaternionSkinning.cs

示例11: AddPositionCalculations

		private void AddPositionCalculations( Function vsMain, ref int funcCounter )
		{
			FunctionInvocation curFuncInvocation = null;

			if ( doBoneCalculations )
			{
				if ( scalingShearingSupport )
				{
					//Construct a scaling and shearing matrix based on the blend weights
					for ( int i = 0; i < WeightCount; i++ )
					{
						//Assign the local param based on the current index of the scaling and shearing matrices
						curFuncInvocation = new FunctionInvocation( FFPRenderState.FFPFuncAssign,
						                                            (int)FFPRenderState.FFPVertexShaderStage.VSTransform,
						                                            funcCounter++ );
						curFuncInvocation.PushOperand( this.paramInScaleShearMatrices, Operand.OpSemantic.In );
						curFuncInvocation.PushOperand( paramInIndices, Operand.OpSemantic.In, (int)IndexToMask( i ), 1 );
						curFuncInvocation.PushOperand( this.paramTempFloat3x4, Operand.OpSemantic.Out );
						vsMain.AddAtomInstance( curFuncInvocation );

						//Calculate the resultant scaling and shearing matrix based on the weigts given
						AddIndexedPositionWeight( vsMain, i, this.paramTempFloat3x4, this.paramTempFloat3x4, this.paramBlendS,
						                          ref funcCounter );
					}

					//Transform the position based on the scaling and shearing matrix
					curFuncInvocation = new FunctionInvocation( FFPRenderState.FFPFuncTransform,
					                                            (int)FFPRenderState.FFPVertexShaderStage.VSTransform,
					                                            funcCounter++ );
					curFuncInvocation.PushOperand( this.paramBlendS, Operand.OpSemantic.In );
					curFuncInvocation.PushOperand( paramInPosition, Operand.OpSemantic.In,
					                               (int)( Operand.OpMask.X | Operand.OpMask.Y | Operand.OpMask.Z ) );
					curFuncInvocation.PushOperand( this.paramLocalBlendPosition, Operand.OpSemantic.Out );
					vsMain.AddAtomInstance( curFuncInvocation );
				}
				else
				{
					//Assign the input position to the local blended position
					curFuncInvocation = new FunctionInvocation( FFPRenderState.FFPFuncAssign,
					                                            (int)FFPRenderState.FFPVertexShaderStage.VSTransform,
					                                            funcCounter++ );
					curFuncInvocation.PushOperand( paramInPosition, Operand.OpSemantic.In,
					                               (int)( Operand.OpMask.X | Operand.OpMask.Y | Operand.OpMask.Z ) );
					curFuncInvocation.PushOperand( this.paramLocalBlendPosition, Operand.OpSemantic.Out );
					vsMain.AddAtomInstance( curFuncInvocation );
				}

				//Set functions to calculate world position
				for ( int i = 0; i < weightCount; i++ )
				{
					curFuncInvocation = new FunctionInvocation( FFPRenderState.FFPFuncAssign,
					                                            (int)FFPRenderState.FFPVertexShaderStage.VSTransform,
					                                            funcCounter++ );
					curFuncInvocation.PushOperand( paramInIndices, Operand.OpSemantic.In, (int)IndexToMask( i ) );
					curFuncInvocation.PushOperand( this.paramIndex1, Operand.OpSemantic.Out );
					vsMain.AddAtomInstance( curFuncInvocation );

					//multiply the index by 2
					curFuncInvocation = new FunctionInvocation( FFPRenderState.FFPFuncModulate,
					                                            (int)FFPRenderState.FFPVertexShaderStage.VSTransform,
					                                            funcCounter++ );
					curFuncInvocation.PushOperand( ParameterFactory.CreateConstParamFloat( 2.0f ), Operand.OpSemantic.In );
					curFuncInvocation.PushOperand( this.paramIndex1, Operand.OpSemantic.In );
					curFuncInvocation.PushOperand( this.paramIndex1, Operand.OpSemantic.Out );
					vsMain.AddAtomInstance( curFuncInvocation );

					//Add 1 to the index and assign as the second row's index
					curFuncInvocation = new FunctionInvocation( FFPRenderState.FFPFuncAdd,
					                                            (int)FFPRenderState.FFPVertexShaderStage.VSTransform,
					                                            funcCounter++ );
					curFuncInvocation.PushOperand( ParameterFactory.CreateConstParamFloat( 1.0f ), Operand.OpSemantic.In );
					curFuncInvocation.PushOperand( this.paramIndex1, Operand.OpSemantic.In );
					curFuncInvocation.PushOperand( this.paramIndex2, Operand.OpSemantic.Out );
					vsMain.AddAtomInstance( curFuncInvocation );

					//Build the dual quaternion matrix
					curFuncInvocation = new FunctionInvocation(
						DualQuaternionSkinning.SGXFuncBuildDualQuaternionMatrix,
						(int)FFPRenderState.FFPVertexShaderStage.VSTransform, funcCounter++ );
					curFuncInvocation.PushOperand( paramInWorldMatrices, Operand.OpSemantic.In );
					curFuncInvocation.PushOperand( this.paramIndex1, Operand.OpSemantic.In, (int)Operand.OpMask.All, 1 );
					curFuncInvocation.PushOperand( paramInWorldMatrices, Operand.OpSemantic.In );
					curFuncInvocation.PushOperand( this.paramIndex2, Operand.OpSemantic.In, (int)Operand.OpMask.All, 1 );
					curFuncInvocation.PushOperand( this.paramTempFloat2x4, Operand.OpSemantic.Out );
					vsMain.AddAtomInstance( curFuncInvocation );

					if ( correctAntipodalityHandling )
					{
						AdjustForCorrectAntipodality( vsMain, i, ref funcCounter, this.paramTempFloat2x4 );
					}

					//Calculate the resultant dual quaternion based based on the weights given
					AddIndexedPositionWeight( vsMain, i, this.paramTempFloat2x4, this.paramTempFloat2x4, this.paramBlendDQ,
					                          ref funcCounter );
				}
				//Normalize the dual quaternion
				curFuncInvocation = new FunctionInvocation( DualQuaternionSkinning.SGXFuncNormalizeDualQuaternion,
				                                            (int)FFPRenderState.FFPVertexShaderStage.VSTransform,
				                                            funcCounter++ );
				curFuncInvocation.PushOperand( this.paramBlendDQ, Operand.OpSemantic.InOut );
//.........这里部分代码省略.........
开发者ID:ryan-bunker,项目名称:axiom3d,代码行数:101,代码来源:DualQuaternionSkinning.cs

示例12: AddPSBlendInvocations

		protected virtual void AddPSBlendInvocations( Function psMain, Parameter arg1, Parameter arg2, Parameter texel,
		                                              int samplerIndex, LayerBlendModeEx blendMode,
		                                              int groupOrder, ref int internalCounter, int targetChannels )
		{
			FunctionInvocation curFuncInvocation = null;

			switch ( blendMode.operation )
			{
				case LayerBlendOperationEx.Add:
					curFuncInvocation = new FunctionInvocation( FFPRenderState.FFPFuncAdd, groupOrder, internalCounter++ );
					curFuncInvocation.PushOperand( arg1, Operand.OpSemantic.In, targetChannels );
					curFuncInvocation.PushOperand( arg2, Operand.OpSemantic.In, targetChannels );
					curFuncInvocation.PushOperand( this.psOutDiffuse, Operand.OpSemantic.Out, targetChannels );
					psMain.AddAtomInstance( curFuncInvocation );
					break;
				case LayerBlendOperationEx.AddSigned:
					curFuncInvocation = new FunctionInvocation( FFPRenderState.FFPFuncAddSigned, groupOrder,
					                                            internalCounter++ );
					curFuncInvocation.PushOperand( arg1, Operand.OpSemantic.In, targetChannels );
					curFuncInvocation.PushOperand( arg2, Operand.OpSemantic.In, targetChannels );
					curFuncInvocation.PushOperand( this.psOutDiffuse, Operand.OpSemantic.Out, targetChannels );
					psMain.AddAtomInstance( curFuncInvocation );
					break;
				case LayerBlendOperationEx.AddSmooth:
					curFuncInvocation = new FunctionInvocation( FFPRenderState.FFPFuncAddSmooth, groupOrder,
					                                            internalCounter++ );
					curFuncInvocation.PushOperand( arg1, Operand.OpSemantic.In, targetChannels );
					curFuncInvocation.PushOperand( arg2, Operand.OpSemantic.In, targetChannels );
					curFuncInvocation.PushOperand( this.psOutDiffuse, Operand.OpSemantic.Out, targetChannels );
					psMain.AddAtomInstance( curFuncInvocation );
					break;
				case LayerBlendOperationEx.BlendCurrentAlpha:
					curFuncInvocation = new FunctionInvocation( FFPRenderState.FFPFuncLerp, groupOrder,
					                                            internalCounter++ );
					curFuncInvocation.PushOperand( arg2, Operand.OpSemantic.In, targetChannels );
					curFuncInvocation.PushOperand( arg1, Operand.OpSemantic.In, targetChannels );

					if ( samplerIndex == 0 )
					{
						curFuncInvocation.PushOperand( this.psDiffuse, Operand.OpSemantic.In, Operand.OpMask.W );
					}
					else
					{
						curFuncInvocation.PushOperand( this.psOutDiffuse, Operand.OpSemantic.In, Operand.OpMask.W );
					}
					curFuncInvocation.PushOperand( this.psOutDiffuse, Operand.OpSemantic.Out, targetChannels );
					psMain.AddAtomInstance( curFuncInvocation );
					break;
				case LayerBlendOperationEx.BlendDiffuseAlpha:
					curFuncInvocation = new FunctionInvocation( FFPRenderState.FFPFuncSubtract, groupOrder,
					                                            internalCounter++ );
					curFuncInvocation.PushOperand( arg1, Operand.OpSemantic.In, targetChannels );
					curFuncInvocation.PushOperand( arg2, Operand.OpSemantic.In, targetChannels );
					curFuncInvocation.PushOperand( this.psDiffuse, Operand.OpSemantic.In, Operand.OpMask.W );
					curFuncInvocation.PushOperand( this.psOutDiffuse, Operand.OpSemantic.Out, targetChannels );
					psMain.AddAtomInstance( curFuncInvocation );
					break;
				case LayerBlendOperationEx.BlendDiffuseColor:
					curFuncInvocation = new FunctionInvocation( FFPRenderState.FFPFuncLerp, groupOrder,
					                                            internalCounter++ );
					curFuncInvocation.PushOperand( arg2, Operand.OpSemantic.In, targetChannels );
					curFuncInvocation.PushOperand( arg1, Operand.OpSemantic.In, targetChannels );
					curFuncInvocation.PushOperand( this.psDiffuse, Operand.OpSemantic.In );
					curFuncInvocation.PushOperand( this.psOutDiffuse, Operand.OpSemantic.Out, targetChannels );
					psMain.AddAtomInstance( curFuncInvocation );
					break;
				case LayerBlendOperationEx.BlendManual:
					curFuncInvocation = new FunctionInvocation( FFPRenderState.FFPFuncLerp, groupOrder, internalCounter );
					curFuncInvocation.PushOperand( arg2, Operand.OpSemantic.In, targetChannels );
					curFuncInvocation.PushOperand( arg1, Operand.OpSemantic.In, targetChannels );
					curFuncInvocation.PushOperand( ParameterFactory.CreateConstParamFloat( blendMode.blendFactor ),
					                               Operand.OpSemantic.In );
					curFuncInvocation.PushOperand( this.psOutDiffuse, Operand.OpSemantic.Out, targetChannels );
					psMain.AddAtomInstance( curFuncInvocation );
					break;
				case LayerBlendOperationEx.BlendTextureAlpha:
					curFuncInvocation = new FunctionInvocation( FFPRenderState.FFPFuncLerp, groupOrder,
					                                            internalCounter++ );
					curFuncInvocation.PushOperand( arg1, Operand.OpSemantic.In, targetChannels );
					curFuncInvocation.PushOperand( arg2, Operand.OpSemantic.In, targetChannels );
					curFuncInvocation.PushOperand( texel, Operand.OpSemantic.In, Operand.OpMask.W );
					curFuncInvocation.PushOperand( this.psOutDiffuse, Operand.OpSemantic.Out, targetChannels );
					psMain.AddAtomInstance( curFuncInvocation );
					break;
				case LayerBlendOperationEx.DotProduct:
					curFuncInvocation = new FunctionInvocation( FFPRenderState.FFPFuncDotProduct, groupOrder,
					                                            internalCounter++ );
					curFuncInvocation.PushOperand( arg2, Operand.OpSemantic.In, targetChannels );
					curFuncInvocation.PushOperand( arg1, Operand.OpSemantic.In, targetChannels );
					curFuncInvocation.PushOperand( this.psOutDiffuse, Operand.OpSemantic.Out, targetChannels );
					psMain.AddAtomInstance( curFuncInvocation );
					break;
				case LayerBlendOperationEx.Modulate:
					curFuncInvocation = new FunctionInvocation( FFPRenderState.FFPFuncModulate, groupOrder,
					                                            internalCounter++ );
					curFuncInvocation.PushOperand( arg1, Operand.OpSemantic.In, targetChannels );
					curFuncInvocation.PushOperand( arg2, Operand.OpSemantic.In, targetChannels );
					curFuncInvocation.PushOperand( this.psOutDiffuse, Operand.OpSemantic.Out, targetChannels );
					psMain.AddAtomInstance( curFuncInvocation );
					break;
//.........这里部分代码省略.........
开发者ID:ryan-bunker,项目名称:axiom3d,代码行数:101,代码来源:FFPTexturing.cs

示例13: AddPSArgumentInvocations

		protected virtual void AddPSArgumentInvocations( Function psMain, Parameter arg, Parameter texel,
		                                                 int samplerIndex, LayerBlendSource blendSrc, ColorEx colorValue,
		                                                 Real alphaValue, bool isAlphaArgument, int groupOrder,
		                                                 ref int internalCounter )
		{
			FunctionInvocation curFuncInvocation = null;

			switch ( blendSrc )
			{
				case LayerBlendSource.Current:
					curFuncInvocation = new FunctionInvocation( FFPRenderState.FFPFuncAssign, groupOrder, internalCounter++ );
					if ( samplerIndex == 0 )
					{
						curFuncInvocation.PushOperand( this.psDiffuse, Operand.OpSemantic.In );
					}
					else
					{
						curFuncInvocation.PushOperand( this.psOutDiffuse, Operand.OpSemantic.In );
					}
					curFuncInvocation.PushOperand( arg, Operand.OpSemantic.Out );
					psMain.AddAtomInstance( curFuncInvocation );
					break;

				case LayerBlendSource.Texture:
					curFuncInvocation = new FunctionInvocation( FFPRenderState.FFPFuncAssign, groupOrder,
					                                            internalCounter++ );
					curFuncInvocation.PushOperand( texel, Operand.OpSemantic.In );
					curFuncInvocation.PushOperand( arg, Operand.OpSemantic.Out );
					psMain.AddAtomInstance( curFuncInvocation );
					break;

				case LayerBlendSource.Specular:
					curFuncInvocation = new FunctionInvocation( FFPRenderState.FFPFuncAssign, groupOrder,
					                                            internalCounter++ );
					curFuncInvocation.PushOperand( this.psSpecular, Operand.OpSemantic.In );
					curFuncInvocation.PushOperand( arg, Operand.OpSemantic.Out );
					psMain.AddAtomInstance( curFuncInvocation );
					break;

				case LayerBlendSource.Diffuse:
					curFuncInvocation = new FunctionInvocation( FFPRenderState.FFPFuncAssign, groupOrder,
					                                            internalCounter++ );
					curFuncInvocation.PushOperand( this.psDiffuse, Operand.OpSemantic.In );
					curFuncInvocation.PushOperand( arg, Operand.OpSemantic.Out );
					psMain.AddAtomInstance( curFuncInvocation );
					break;
				case LayerBlendSource.Manual:
					curFuncInvocation = new FunctionInvocation( FFPRenderState.FFPFuncConstruct, groupOrder,
					                                            internalCounter++ );

					if ( isAlphaArgument )
					{
						curFuncInvocation.PushOperand( ParameterFactory.CreateConstParamFloat( alphaValue ),
						                               Operand.OpSemantic.In );
					}
					else
					{
						curFuncInvocation.PushOperand( ParameterFactory.CreateConstParamFloat( colorValue.r ),
						                               Operand.OpSemantic.In );
						curFuncInvocation.PushOperand( ParameterFactory.CreateConstParamFloat( colorValue.g ),
						                               Operand.OpSemantic.In );
						curFuncInvocation.PushOperand( ParameterFactory.CreateConstParamFloat( colorValue.b ),
						                               Operand.OpSemantic.In );
						curFuncInvocation.PushOperand( ParameterFactory.CreateConstParamFloat( colorValue.a ),
						                               Operand.OpSemantic.In );
					}

					curFuncInvocation.PushOperand( arg, Operand.OpSemantic.In );
					psMain.AddAtomInstance( curFuncInvocation );
					break;
			}
		}
开发者ID:ryan-bunker,项目名称:axiom3d,代码行数:72,代码来源:FFPTexturing.cs

示例14: AddVSInvocation

		protected bool AddVSInvocation( Function vsMain, int groupOrder, ref int internalCounter )
		{
			FunctionInvocation curFuncInvocation = null;

			//transform normal in view space
			curFuncInvocation = new FunctionInvocation( SGXFuncTransformNormal, groupOrder, internalCounter++ );
			curFuncInvocation.PushOperand( this.worldViewITMatrix, Operand.OpSemantic.In );
			curFuncInvocation.PushOperand( this.vsInNormal, Operand.OpSemantic.In );
			curFuncInvocation.PushOperand( this.vsOutNormal, Operand.OpSemantic.Out );
			vsMain.AddAtomInstance( curFuncInvocation );

			//Transform view space position if need to
			if ( this.vsOutViewPos != null )
			{
				curFuncInvocation = new FunctionInvocation( SGXFuncTransformPosition, groupOrder, internalCounter++ );
				curFuncInvocation.PushOperand( this.worldViewMatrix, Operand.OpSemantic.In );
				curFuncInvocation.PushOperand( this.vsInPosition, Operand.OpSemantic.In );
				curFuncInvocation.PushOperand( this.vsOutViewPos, Operand.OpSemantic.Out );
				vsMain.AddAtomInstance( curFuncInvocation );
			}

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

示例15: AddPositionCalculations

		private void AddPositionCalculations( Function vsMain, ref int funcCounter )
		{
			FunctionInvocation curFuncInvocation = null;

			if ( doBoneCalculations == true )
			{
				//set functions to calculate world position
				for ( int i = 0; i < WeightCount; i++ )
				{
					AddIndexedPositionWeight( vsMain, i, ref funcCounter );
				}

				//update back the original position relative to the object
				curFuncInvocation = new FunctionInvocation( FFPRenderState.FFPFuncTransform,
				                                            (int)FFPRenderState.FFPVertexShaderStage.VSTransform,
				                                            funcCounter++ );
				curFuncInvocation.PushOperand( paramInInvWorldMatrix, Operand.OpSemantic.In );
				curFuncInvocation.PushOperand( paramLocalPositionWorld, Operand.OpSemantic.In );
				curFuncInvocation.PushOperand( paramInPosition, Operand.OpSemantic.Out );
				vsMain.AddAtomInstance( curFuncInvocation );

				//update the projective position thereby filling the transform stage role
				curFuncInvocation = new FunctionInvocation( FFPRenderState.FFPFuncTransform,
				                                            (int)FFPRenderState.FFPVertexShaderStage.VSTransform,
				                                            funcCounter++ );
				curFuncInvocation.PushOperand( paramInViewProjMatrix, Operand.OpSemantic.In );
				curFuncInvocation.PushOperand( paramLocalPositionWorld, Operand.OpSemantic.In );
				curFuncInvocation.PushOperand( paramOutPositionProj, Operand.OpSemantic.Out );
				vsMain.AddAtomInstance( curFuncInvocation );
			}
			else
			{
				//update from object to world space
				curFuncInvocation = new FunctionInvocation( FFPRenderState.FFPFuncTransform,
				                                            (int)FFPRenderState.FFPVertexShaderStage.VSTransform,
				                                            funcCounter++ );
				curFuncInvocation.PushOperand( paramInWorldMatrix, Operand.OpSemantic.In );
				curFuncInvocation.PushOperand( paramInPosition, Operand.OpSemantic.In );
				curFuncInvocation.PushOperand( paramLocalPositionWorld, Operand.OpSemantic.Out );
				vsMain.AddAtomInstance( curFuncInvocation );

				//update from ojbect to projective space
				curFuncInvocation = new FunctionInvocation( FFPRenderState.FFPFuncTransform,
				                                            (int)FFPRenderState.FFPVertexShaderStage.VSTransform,
				                                            funcCounter++ );
				curFuncInvocation.PushOperand( paramInWorldViewProjMatrix, Operand.OpSemantic.In );
				curFuncInvocation.PushOperand( paramInPosition, Operand.OpSemantic.In );
				curFuncInvocation.PushOperand( paramOutPositionProj, Operand.OpSemantic.Out );
				vsMain.AddAtomInstance( curFuncInvocation );
			}
		}
开发者ID:ryan-bunker,项目名称:axiom3d,代码行数:51,代码来源:LinearSkinning.cs


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