Kav/Resources.cs

73 lines
1.8 KiB
C#

using System.IO;
namespace Kav
{
internal class Resources
{
public static byte[] DeferredPBR_GBufferEffect
{
get
{
if (gBufferEffect == null)
{
gBufferEffect = GetResource("DeferredPBR_GBufferEffect");
}
return gBufferEffect;
}
}
public static byte[] DeferredPBREffect
{
get
{
if (deferredPBREffect == null)
{
deferredPBREffect = GetResource("DeferredPBREffect");
}
return deferredPBREffect;
}
}
public static byte[] PBREffect
{
get
{
if (pbrEffect == null)
{
pbrEffect = GetResource("PBREffect");
}
return pbrEffect;
}
}
public static byte[] SimpleDepthEffect
{
get
{
if (simpleDepthEffect == null)
{
simpleDepthEffect = GetResource("SimpleDepthEffect");
}
return simpleDepthEffect;
}
}
private static byte[] gBufferEffect;
private static byte[] deferredPBREffect;
private static byte[] pbrEffect;
private static byte[] simpleDepthEffect;
private static byte[] GetResource(string name)
{
Stream stream = typeof(Resources).Assembly.GetManifestResourceStream(
"Kav.Resources." + name + ".fxb"
);
using (MemoryStream ms = new MemoryStream())
{
stream.CopyTo(ms);
return ms.ToArray();
}
}
}
}