Fixed a performance problem in the Visual Studio extension where no importer or processor was selected for an asset. Fixed that the asset names for Uri encoded in the build output. Fixed that errors when serializing assets get logged. Sped up ImporterManager.GuessImporterByFileExtension, which caused performance problems if many assemblies are loaded into the current AppDomain. Made the AssimpImporter library deploy the binary files again (hopefully just a temporary solution until we've found a better way.) Provide a extension for TargetPlatform enum for getting the DisplayName of an entry. Changed that ProcessorManager.GetProcessorDisplayName doesn't throw an exception if no processor with the given name exists, which now mimicks the same behavior as in importerManager.GetImporterDisplayName.
51 lines
1.9 KiB
C#
51 lines
1.9 KiB
C#
#region Using Statements
|
|
using System.IO;
|
|
using ANX.Framework.Content.Pipeline.Graphics;
|
|
using ANX.Framework.NonXNA;
|
|
|
|
#endregion
|
|
|
|
// This file is part of the ANX.Framework created by the
|
|
// "ANX.Framework developer group" and released under the Ms-PL license.
|
|
// For details see: http://anxframework.codeplex.com/license
|
|
|
|
namespace ANX.Framework.Content.Pipeline
|
|
{
|
|
[ContentImporter(new string[] { ".fx", ".fxg", ".hlsl", ".glsl" }, Category = "Effect Files")]
|
|
public class EffectImporter : ContentImporter<EffectContent>
|
|
{
|
|
public override EffectContent Import(string filename, ContentImporterContext context)
|
|
{
|
|
string fileExtension = Path.GetExtension(filename).ToLowerInvariant();
|
|
EffectSourceLanguage sourceLanguage = EffectSourceLanguage.HLSL_FX;
|
|
|
|
switch (fileExtension)
|
|
{
|
|
case ".fx":
|
|
sourceLanguage = EffectSourceLanguage.HLSL_FX;
|
|
break;
|
|
case ".fxg":
|
|
sourceLanguage = EffectSourceLanguage.GLSL_FX;
|
|
break;
|
|
case ".hlsl":
|
|
sourceLanguage = EffectSourceLanguage.HLSL;
|
|
break;
|
|
case ".glsl":
|
|
sourceLanguage = EffectSourceLanguage.GLSL;
|
|
break;
|
|
default:
|
|
throw new InvalidContentException("The EffectImporter is not able to import a file with extension '" + fileExtension + "'");
|
|
}
|
|
|
|
EffectContent content = new EffectContent()
|
|
{
|
|
EffectCode = System.IO.File.ReadAllText(filename),
|
|
Identity = new ContentIdentity(filename, null, null),
|
|
SourceLanguage = sourceLanguage,
|
|
};
|
|
|
|
return content;
|
|
}
|
|
}
|
|
}
|