Kav/Resources.cs

111 lines
3.0 KiB
C#

using System.IO;
namespace Kav
{
internal class Resources
{
public static byte[] DeferredPBR_AmbientLightEffect
{
get
{
if (ambientLightEffect == null)
{
ambientLightEffect = GetResource("DeferredPBR_AmbientLightEffect");
}
return ambientLightEffect;
}
}
public static byte[] DeferredPBR_PointLightEffect
{
get
{
if (pointLightEffect == null)
{
pointLightEffect = GetResource("DeferredPBR_PointLightEffect");
}
return pointLightEffect;
}
}
public static byte[] DeferredPBR_DirectionalLightEffect
{
get
{
if (directionalLightEffect == null)
{
directionalLightEffect = GetResource("DeferredPBR_DirectionalLightEffect");
}
return directionalLightEffect;
}
}
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[] ambientLightEffect;
private static byte[] pointLightEffect;
private static byte[] directionalLightEffect;
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();
}
}
}
}