Glatzemann 3764074514 - some cosmetics on XNBValidator tool
- more work on our own ContentPipeline implementation: effect files are now imported, processed (compiled using fxc.exe) and serialized to a .xnb file. Needs testing...
2012-08-22 10:34:39 +00:00

66 lines
1.8 KiB
C#

#region Using Statements
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ANX.Framework.Content.Pipeline.Graphics;
using System.IO;
using System.ComponentModel;
#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.Processors
{
[ContentProcessor]
public class EffectProcessor : ContentProcessor<EffectContent, CompiledEffectContent>
{
HLSLCompilerFactory hlslCompilerFactory = new HLSLCompilerFactory();
private string targetProfile = "fx_4_0";
public virtual EffectProcessorDebugMode DebugMode
{
get;
set;
}
public virtual string Defines
{
get;
set;
}
[DefaultValue("fx_4_0")]
public virtual string TargetProfile
{
get
{
return targetProfile;
}
set
{
targetProfile = value;
}
}
public override CompiledEffectContent Process(EffectContent input, ContentProcessorContext context)
{
HLSLCompiler compiler = hlslCompilerFactory.Compilers.Last<HLSLCompiler>();
byte[] effectCompiledCode = compiler.Compile(input.EffectCode, DebugMode, TargetProfile);
return new CompiledEffectContent(effectCompiledCode)
{
Identity = input.Identity,
Name = input.Name,
OpaqueData = input.OpaqueData
};
}
}
}