Base material with color texture, surface texture, normal map and emission texture. Material has dirt texture and optional detail map. Emission OR detail map could be modulated by color texture alpha.
示例#1
0
		/// <summary>
		/// Exports material to xml
		/// </summary>
		/// <returns></returns>
		public static string ExportToXml ( BaseIllum material )
		{
			return Misc.SaveObjectToXml( material, material.GetType(), Misc.GetAllSubclassesOf( typeof(BaseIllum) ) );
		}
示例#2
0
		/// <summary>
		/// Intializes graphics engine.
		/// </summary>
		public override void Initialize ()
		{
			whiteTexture	=	new DynamicTexture( this, 4,4, typeof(Color), false, false );
			whiteTexture.SetData( Enumerable.Range(0,16).Select( i => Color.White ).ToArray() );
			
			grayTexture		=	new DynamicTexture( this, 4,4, typeof(Color), false, false );
			grayTexture.SetData( Enumerable.Range(0,16).Select( i => Color.Gray ).ToArray() );

			blackTexture	=	new DynamicTexture( this, 4,4, typeof(Color), false, false );
			blackTexture.SetData( Enumerable.Range(0,16).Select( i => Color.Black ).ToArray() );

			flatNormalMap	=	new DynamicTexture( this, 4,4, typeof(Color), false, false );
			flatNormalMap.SetData( Enumerable.Range(0,16).Select( i => new Color(127,127,255,127) ).ToArray() );

			var baseIllum = new BaseIllum();
			defaultMaterial	=	baseIllum.CreateMaterialInstance(this, Game.Content);

			//	add default render world
			renderWorld	=	new RenderWorld(Game, Width, Height);
			AddLayer( renderWorld );
		}
示例#3
0
		static void ResolveMaterial ( MaterialRef material, string relativeSceneDir, string fullSceneDir )
		{
			var mtrlName		=	ContentUtils.CreateSafeName( material.Name );
			var texPath			=	material.Texture ?? "";

			material.Name		=	Path.Combine( relativeSceneDir, mtrlName );
			material.Texture	=	Path.Combine( relativeSceneDir, texPath );
			var mtrlFileName	=	Path.Combine( fullSceneDir, mtrlName + ".material" );


			if (!File.Exists(mtrlFileName)) {

				var newMtrl =	new BaseIllum();

				newMtrl.ColorTexture.Path		=	ResolveTexture( relativeSceneDir, fullSceneDir, texPath, ""			, newMtrl.ColorTexture.Path		);  
				newMtrl.SurfaceTexture.Path		=	ResolveTexture( relativeSceneDir, fullSceneDir, texPath, "_surf"	, newMtrl.SurfaceTexture.Path	);  
				newMtrl.NormalMapTexture.Path	=	ResolveTexture( relativeSceneDir, fullSceneDir, texPath, "_local"	, newMtrl.NormalMapTexture.Path	);  
				newMtrl.EmissionTexture.Path	=	ResolveTexture( relativeSceneDir, fullSceneDir, texPath, "_glow"	, newMtrl.EmissionTexture.Path	);  

				File.WriteAllText( mtrlFileName, BaseIllum.ExportToXml(newMtrl) );
			}

		}