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


C# Serialization.MaterialScriptContext类代码示例

本文整理汇总了C#中Axiom.Serialization.MaterialScriptContext的典型用法代码示例。如果您正苦于以下问题:C# MaterialScriptContext类的具体用法?C# MaterialScriptContext怎么用?C# MaterialScriptContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: ParseBindingType

		protected static bool ParseBindingType( string parameters, MaterialScriptContext context )
		{
			switch ( parameters.ToLower() )
			{
				case "texture":
					context.textureUnit.BindingType = TextureBindingType.Fragment;
					break;
				case "vertex":
					context.textureUnit.BindingType = TextureBindingType.Vertex;
					break;
				default:
					LogParseError( context, "Invalid binding type option - {0}", parameters );
					break;
			}
			return false;
		}
开发者ID:mono-soc-2011,项目名称:axiom,代码行数:16,代码来源:MaterialSerializer.cs

示例2: ParseAmbient

		protected static bool ParseAmbient( string parameters, MaterialScriptContext context )
		{
			string[] values = parameters.Split( new char[] { ' ', '\t' } );

			// must be 1, 3 or 4 parameters
			if ( values.Length == 1 )
			{
				if ( values[ 0 ].ToLower() == "vertexcolour" ||
					 values[ 0 ].ToLower() == "vertexcolor" )
				{
					context.pass.VertexColorTracking |= TrackVertexColor.Ambient;
				}
				else
				{
					LogParseError( context, "Bad ambient attribute, single parameter flag must be 'vertexcolour' or 'vertexcolor'." );
				}
			}
			else if ( values.Length == 3 || values.Length == 4 )
			{
				context.pass.Ambient = StringConverter.ParseColor( values );
				context.pass.VertexColorTracking &= ~TrackVertexColor.Ambient;
			}
			else
			{
				LogParseError( context, "Bad ambient attribute, wrong number of parameters (expected 1, 3 or 4)." );
			}

			return false;
		}
开发者ID:mono-soc-2011,项目名称:axiom,代码行数:29,代码来源:MaterialSerializer.cs

示例3: ParseCullSoftware

		protected static bool ParseCullSoftware( string parameters, MaterialScriptContext context )
		{
			// lookup the real enum equivalent to the script value
			object val = ScriptEnumAttribute.Lookup( parameters, typeof( ManualCullingMode ) );

			// if a value was found, assign it
			if ( val != null )
			{
				context.pass.ManualCullingMode = (ManualCullingMode)val;
			}
			else
			{
				string legalValues = ScriptEnumAttribute.GetLegalValues( typeof( ManualCullingMode ) );
				LogParseError( context, "Bad cull_software attribute, valid parameters are {0}.", legalValues );
			}

			return false;
		}
开发者ID:mono-soc-2011,项目名称:axiom,代码行数:18,代码来源:MaterialSerializer.cs

示例4: ParseLodDistances

		protected static bool ParseLodDistances( string parameters, MaterialScriptContext context )
		{
			context.material.LodStrategy = LodStrategyManager.Instance.GetStrategy( DistanceLodStrategy.StrategyName );

			string[] values = parameters.Split( new char[] { ' ', '\t' } );

			LodValueList lodDistances = new LodValueList();

			for ( int i = 0; i < values.Length; i++ )
			{
				lodDistances.Add( StringConverter.ParseFloat( values[ i ] ) );
			}

			context.material.SetLodLevels( lodDistances );

			return false;
		}
开发者ID:mono-soc-2011,项目名称:axiom,代码行数:17,代码来源:MaterialSerializer.cs

示例5: ParseLodIndex

		protected static bool ParseLodIndex( string parameters, MaterialScriptContext context )
		{
			context.technique.LodIndex = int.Parse( parameters );

			return false;
		}
开发者ID:mono-soc-2011,项目名称:axiom,代码行数:6,代码来源:MaterialSerializer.cs

示例6: ParseTextureUnit

		protected static bool ParseTextureUnit( string parameters, MaterialScriptContext context )
		{
			// create a new texture unit
			context.textureUnit = context.pass.CreateTextureUnitState();

			// get the texture unit name
			string[] values = parameters.Split( new char[] { ' ', '\t' } );
			if ( values.Length > 0 && values[ 0 ].Length > 0 )
				context.textureUnit.Name = values[ 0 ];

			// update section
			context.section = MaterialScriptSection.TextureUnit;

			// increase texture unit level depth
			context.stateLev++;

			// return true because this must be followed by a {
			return true;
		}
开发者ID:mono-soc-2011,项目名称:axiom,代码行数:19,代码来源:MaterialSerializer.cs

示例7: ParseSetTextureAlias

		protected static bool ParseSetTextureAlias( string parameters, MaterialScriptContext context )
		{
			// get the texture alias
			string[] values = parameters.Split( new char[] { ' ', '\t' } );

			if ( values.Length != 2 )
			{
				LogParseError( context, "Invalid set_texture_alias entry - expected 2 parameters." );
				return true;
			}
			// update section
			if ( context.textureAliases.ContainsKey( values[ 0 ] ) )
			{
				context.textureAliases[ values[ 0 ] ] = values[ 1 ];
			}
			else
			{
				context.textureAliases.Add( values[ 0 ], values[ 1 ] );
			}

			return false;
		}
开发者ID:mono-soc-2011,项目名称:axiom,代码行数:22,代码来源:MaterialSerializer.cs

示例8: ParseProgramMorphAnimation

		protected static bool ParseProgramMorphAnimation( string parameters, MaterialScriptContext context )
		{
			context.programDef.supportsMorphAnimation = bool.Parse( parameters );

			return false;
		}
开发者ID:mono-soc-2011,项目名称:axiom,代码行数:6,代码来源:MaterialSerializer.cs

示例9: ParseProgramPoseAnimation

		protected static bool ParseProgramPoseAnimation( string parameters, MaterialScriptContext context )
		{
			context.programDef.poseAnimationCount = ushort.Parse( parameters );

			return false;
		}
开发者ID:mono-soc-2011,项目名称:axiom,代码行数:6,代码来源:MaterialSerializer.cs

示例10: ParseProgramSource

		protected static bool ParseProgramSource( string parameters, MaterialScriptContext context )
		{
			// source filename, preserve case
			context.programDef.source = parameters;

			return false;
		}
开发者ID:mono-soc-2011,项目名称:axiom,代码行数:7,代码来源:MaterialSerializer.cs

示例11: ParseProgramSyntax

		protected static bool ParseProgramSyntax( string parameters, MaterialScriptContext context )
		{
			context.programDef.syntax = parameters.ToLower();

			return false;
		}
开发者ID:mono-soc-2011,项目名称:axiom,代码行数:6,代码来源:MaterialSerializer.cs

示例12: ParseParamNamedAuto

		protected static bool ParseParamNamedAuto( string parameters, MaterialScriptContext context )
		{
			// skip this if the program is not supported or could not be found
			if ( context.program == null || !context.program.IsSupported )
			{
				return false;
			}

			string[] values = parameters.Split( new char[] { ' ', '\t' } );

			if ( values.Length != 2 && values.Length != 3 )
			{
				LogParseError( context, "Invalid param_named_auto attribute - expected 2 or 3 parameters." );
				return false;
			}

			// get start index
			try
			{
				int index = context.programParams.GetParamIndex( values[ 0 ] );

				ProcessAutoProgramParam( index, "param_named_auto", values, context );
			}
			catch ( Exception ex )
			{
				LogParseError( context, "Invalid param_named_auto attribute - {0}.", ex.Message );
				return false;
			}

			return false;
		}
开发者ID:mono-soc-2011,项目名称:axiom,代码行数:31,代码来源:MaterialSerializer.cs

示例13: ParseParamIndexedAuto

		protected static bool ParseParamIndexedAuto( string parameters, MaterialScriptContext context )
		{
			// skip this if the program is not supported or could not be found
			if ( context.program == null || !context.program.IsSupported )
			{
				return false;
			}

			string[] values = parameters.Split( new char[] { ' ', '\t' } );

			if ( values.Length != 2 && values.Length != 3 )
			{
				LogParseError( context, "Invalid param_indexed_auto attribute - expected at 2 or 3 parameters." );
				return false;
			}

			// get start index
			int index = int.Parse( values[ 0 ] );

			ProcessAutoProgramParam( index, "param_indexed_auto", values, context );

			return false;
		}
开发者ID:mono-soc-2011,项目名称:axiom,代码行数:23,代码来源:MaterialSerializer.cs

示例14: ParseWaveXForm

		protected static bool ParseWaveXForm( string parameters, MaterialScriptContext context )
		{
			string[] values = parameters.Split( new char[] { ' ', '\t' } );

			if ( values.Length != 6 )
			{
				LogParseError( context, "Bad wave_xform attribute, wrong number of parameters (expected 6)." );
				return false;
			}

			TextureTransform transType = 0;
			WaveformType waveType = 0;

			// check the transform type
			object val = ScriptEnumAttribute.Lookup( values[ 0 ], typeof( TextureTransform ) );

			if ( val == null )
			{
				string legalValues = ScriptEnumAttribute.GetLegalValues( typeof( TextureTransform ) );
				LogParseError( context, "Bad wave_xform attribute, valid transform type values are {0}.", legalValues );
				return false;
			}

			transType = (TextureTransform)val;

			// check the wavetype
			val = ScriptEnumAttribute.Lookup( values[ 1 ], typeof( WaveformType ) );

			if ( val == null )
			{
				string legalValues = ScriptEnumAttribute.GetLegalValues( typeof( WaveformType ) );
				LogParseError( context, "Bad wave_xform attribute, valid waveform type values are {0}.", legalValues );
				return false;

			}

			waveType = (WaveformType)val;

			// set the transform animation
			context.textureUnit.SetTransformAnimation(
				transType,
				waveType,
				StringConverter.ParseFloat( values[ 2 ] ),
				StringConverter.ParseFloat( values[ 3 ] ),
				StringConverter.ParseFloat( values[ 4 ] ),
				StringConverter.ParseFloat( values[ 5 ] ) );

			return false;
		}
开发者ID:mono-soc-2011,项目名称:axiom,代码行数:49,代码来源:MaterialSerializer.cs

示例15: ParseTechnique

		protected static bool ParseTechnique( string parameters, MaterialScriptContext context )
		{
			// create a new technique
			context.technique = context.material.CreateTechnique();

			// update section
			context.section = MaterialScriptSection.Technique;

			// increate technique level depth
			context.techLev++;

			// get the technique name
			string[] values = parameters.Split( new char[] { ' ', '\t' } );

			if ( values.Length > 0 && values[ 0 ].Length > 0 )
				context.technique.Name = values[ 0 ];

			// return true because this must be followed by a {
			return true;
		}
开发者ID:mono-soc-2011,项目名称:axiom,代码行数:20,代码来源:MaterialSerializer.cs


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