/// <summary>
		/// 
		/// </summary>
		/// <param name="sourceStream"></param>
		/// <param name="targetStream"></param>
		public override void Process ( AssetSource assetFile, BuildContext context )
		{
			string tempFileName		= context.GetTempFileName( assetFile.KeyPath, ".fnt" );
			string resolvedPath		= assetFile.FullSourcePath;	

			//	Launch 'bmfont.com' with temporary output file :
			context.RunTool( @"bmfont.com",  string.Format("-c \"{0}\" -o \"{1}\"", resolvedPath, tempFileName ) );


			//	load temporary output :
			SpriteFont.FontFile font;
			using ( var stream = File.OpenRead( tempFileName ) ) {
				font = SpriteFont.FontLoader.Load( stream );
			}


			//	perform some checks :
			if (font.Common.Pages!=1) {
				throw new BuildException("Only one page of font image is supported");
			}


			//	patch font description and add children (e.g. "secondary") content :
			using ( var stream = assetFile.OpenTargetStream() ) {

				using ( var sw = new BinaryWriter( stream ) ) {

					var xml = SpriteFont.FontLoader.SaveToString( font );

					sw.Write( xml );

					//	write pages :
					foreach (var p in font.Pages) {

						var pageFile	=	Path.Combine( Path.GetDirectoryName( tempFileName ), p.File );

						if ( Path.GetExtension( pageFile ).ToLower() == ".dds" ) {

							context.CopyFileTo( pageFile, sw );

						} else {

							TextureProcessor.RunNVCompress( context, pageFile, pageFile + ".dds", true, false, false, true, true, false, TextureProcessor.TextureCompression.RGB );

							context.CopyFileTo( pageFile + ".dds", sw );

						}
					}
				}
			}
		}
Beispiel #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sourceStream"></param>
        /// <param name="targetStream"></param>
        public override void Process(AssetSource assetFile, BuildContext context)
        {
            string tempFileName = context.GetTempFileFullPath(assetFile.KeyPath, ".fnt");
            string resolvedPath = assetFile.FullSourcePath;

            //	Launch 'bmfont.com' with temporary output file :
            context.RunTool(@"bmfont.com", string.Format("-c \"{0}\" -o \"{1}\"", resolvedPath, tempFileName));


            //	load temporary output :
            SpriteFont.FontFile font;
            using (var stream = File.OpenRead(tempFileName)) {
                font = SpriteFont.FontLoader.Load(stream);
            }


            //	perform some checks :
            if (font.Common.Pages != 1)
            {
                throw new BuildException("Only one page of font image is supported");
            }


            //	patch font description and add children (e.g. "secondary") content :
            using (var stream = assetFile.OpenTargetStream()) {
                using (var sw = new BinaryWriter(stream)) {
                    var xml = SpriteFont.FontLoader.SaveToString(font);

                    sw.Write(xml);

                    //	write pages :
                    foreach (var p in font.Pages)
                    {
                        var pageFile = Path.Combine(Path.GetDirectoryName(tempFileName), p.File);

                        if (Path.GetExtension(pageFile).ToLower() == ".dds")
                        {
                            context.CopyFileTo(pageFile, sw);
                        }
                        else
                        {
                            TextureProcessor.RunNVCompress(context, pageFile, pageFile + ".dds", true, false, false, true, true, false, TextureProcessor.TextureCompression.RGB);

                            context.CopyFileTo(pageFile + ".dds", sw);
                        }
                    }
                }
            }
        }
Beispiel #3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sourceStream"></param>
        /// <param name="targetStream"></param>
        public override void Process(AssetSource assetFile, BuildContext context)
        {
            var src = assetFile.FullSourcePath;
            var dst = context.GetTempFileFullPath(assetFile.KeyPath, ".dds");

            RunNVCompress(context, src, dst, NoMips, Fast, ToNormal, Color, Alpha, Normal, Compression);

            using (var target = assetFile.OpenTargetStream()) {
                context.CopyFileTo(dst, target);
            }
        }
		/// <summary>
		/// 
		/// </summary>
		/// <param name="sourceStream"></param>
		/// <param name="targetStream"></param>
		public override void Process ( AssetSource assetFile, BuildContext context )
		{
			var src	=	assetFile.FullSourcePath;
			var dst	=	context.GetTempFileName( assetFile.KeyPath, ".dds" );

			RunNVCompress( context, src, dst, NoMips, Fast, ToNormal, Color, Alpha, Normal, Compression );

			using ( var target = assetFile.OpenTargetStream() ) {
				context.CopyFileTo( dst, target );
			}
		}
		/// <summary>
		/// 
		/// </summary>
		/// <param name="sourceStream"></param>
		/// <param name="targetStream"></param>
		public override void Process ( AssetSource assetFile, BuildContext context )
		{
			var resolvedPath	=	assetFile.FullSourcePath;
			var destPath		=	context.GetTempFileName( assetFile.KeyPath, ".scene" );

			var cmdLine			=	string.Format("\"{0}\" /out:\"{1}\" /base:\"{2}\" /merge:{3} {4} {5} {6} {7}", 
				resolvedPath, 
				destPath, 
				assetFile.BaseDirectory,
				MergeTolerance, 
				ImportAnimation ? "/anim":"", 
				ImportGeometry ? "/geom":"", 
				OutputReport ? "/report":"" ,
				GenerateMissingMaterials ? "/genmtrl":""
			);

			context.RunTool( "FScene.exe", cmdLine );

			using ( var target = assetFile.OpenTargetStream() ) {
				context.CopyFileTo( destPath, target );
			}
		}
Beispiel #6
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sourceStream"></param>
        /// <param name="targetStream"></param>
        public override void Process(AssetSource assetFile, BuildContext context)
        {
            var resolvedPath = assetFile.FullSourcePath;
            var destPath     = context.GetTempFileFullPath(assetFile.KeyPath, ".scene");
            var reportPath   = context.GetTempFileFullPath(assetFile.KeyPath, ".html");

            var cmdLine = string.Format("\"{0}\" /out:\"{1}\" /base:\"{2}\" /merge:{3} {4} {5} {6} {7}",
                                        resolvedPath,
                                        destPath,
                                        assetFile.BaseDirectory,
                                        MergeTolerance,
                                        ImportAnimation ? "/anim":"",
                                        ImportGeometry ? "/geom":"",
                                        OutputReport ? "/report:" + "\"" + reportPath + "\"":"",
                                        GenerateMissingMaterials ? "/genmtrl":""
                                        );

            context.RunTool("FScene.exe", cmdLine);

            using (var target = assetFile.OpenTargetStream()) {
                context.CopyFileTo(destPath, target);
            }
        }