Kav/Resources.cs

203 lines
5.5 KiB
C#
Raw Normal View History

2020-08-05 03:50:44 +00:00
using System.IO;
namespace Kav
{
internal class Resources
{
public static byte[] DeferredPBR_AmbientLightEffect
{
get
{
if (ambientLightEffect == null)
{
2020-10-19 10:01:37 +00:00
ambientLightEffect = GetResource("DeferredPBR_AmbientLightEffect.fxb");
}
return ambientLightEffect;
}
}
public static byte[] DeferredPBR_PointLightEffect
{
get
{
if (pointLightEffect == null)
{
2020-10-19 10:01:37 +00:00
pointLightEffect = GetResource("DeferredPBR_PointLightEffect.fxb");
}
return pointLightEffect;
}
}
public static byte[] DeferredPBR_DirectionalLightEffect
{
get
{
if (directionalLightEffect == null)
{
2020-10-19 10:01:37 +00:00
directionalLightEffect = GetResource("DeferredPBR_DirectionalLightEffect.fxb");
}
return directionalLightEffect;
}
}
public static byte[] DeferredPBR_GBufferEffect
{
get
{
if (gBufferEffect == null)
{
2020-10-19 10:01:37 +00:00
gBufferEffect = GetResource("DeferredPBR_GBufferEffect.fxb");
}
return gBufferEffect;
}
}
public static byte[] ToneMapEffect
{
get
{
if (toneMapEffect == null)
{
2020-10-19 10:01:37 +00:00
toneMapEffect = GetResource("ToneMapEffect.fxb");
}
return toneMapEffect;
}
}
public static byte[] Deferred_ToonEffect
{
get
{
if (deferredToonEffect == null)
{
2020-10-19 10:01:37 +00:00
deferredToonEffect = GetResource("Deferred_ToonEffect.fxb");
}
return deferredToonEffect;
}
}
public static byte[] DeferredPBREffect
{
get
{
if (deferredPBREffect == null)
{
2020-10-19 10:01:37 +00:00
deferredPBREffect = GetResource("DeferredPBREffect.fxb");
}
return deferredPBREffect;
}
}
2020-08-05 03:50:44 +00:00
public static byte[] PBREffect
{
get
{
if (pbrEffect == null)
{
2020-10-19 10:01:37 +00:00
pbrEffect = GetResource("PBREffect.fxb");
2020-08-05 03:50:44 +00:00
}
return pbrEffect;
}
}
2020-08-07 00:58:50 +00:00
public static byte[] SimpleDepthEffect
{
get
{
if (simpleDepthEffect == null)
{
2020-10-19 10:01:37 +00:00
simpleDepthEffect = GetResource("SimpleDepthEffect.fxb");
2020-08-07 00:58:50 +00:00
}
return simpleDepthEffect;
}
}
public static byte[] SimpleDepthEffectInstanced
{
get
{
if (simpleDepthEffectInstanced == null)
{
simpleDepthEffectInstanced = GetResource("SimpleDepthEffectInstanced.fxb");
}
return simpleDepthEffectInstanced;
}
}
2020-10-19 10:01:37 +00:00
public static byte[] LinearDepthEffect
{
get
{
if (linearDepthEffect == null)
{
linearDepthEffect = GetResource("LinearDepthEffect.fxb");
}
return linearDepthEffect;
}
}
public static byte[] SkyboxEffect
{
get
{
if (skyboxEffect == null)
{
skyboxEffect = GetResource("SkyboxEffect.fxb");
}
return skyboxEffect;
}
}
2020-12-06 03:47:01 +00:00
public static byte[] DiffuseLitSpriteEffect
{
get
{
if (diffuseLitSpriteEffect == null)
{
diffuseLitSpriteEffect = GetResource("DiffuseLitSpriteEffect.fxb");
}
return diffuseLitSpriteEffect;
}
}
2020-10-19 10:01:37 +00:00
public static byte[] UnitCubeModel
{
get
{
if (unitCubeModel == null)
{
unitCubeModel = GetResource("UnitCube.glb");
}
return unitCubeModel;
}
}
private static byte[] ambientLightEffect;
private static byte[] pointLightEffect;
private static byte[] directionalLightEffect;
private static byte[] gBufferEffect;
private static byte[] toneMapEffect;
private static byte[] deferredToonEffect;
private static byte[] deferredPBREffect;
2020-08-05 03:50:44 +00:00
private static byte[] pbrEffect;
2020-08-07 00:58:50 +00:00
private static byte[] simpleDepthEffect;
private static byte[] simpleDepthEffectInstanced;
2020-10-19 10:01:37 +00:00
private static byte[] linearDepthEffect;
private static byte[] skyboxEffect;
2020-12-06 03:47:01 +00:00
private static byte[] diffuseLitSpriteEffect;
2020-10-19 10:01:37 +00:00
private static byte[] unitCubeModel;
2020-08-05 03:50:44 +00:00
private static byte[] GetResource(string name)
{
Stream stream = typeof(Resources).Assembly.GetManifestResourceStream(
2020-10-19 10:01:37 +00:00
"Kav.Resources." + name
2020-08-05 03:50:44 +00:00
);
using (MemoryStream ms = new MemoryStream())
{
stream.CopyTo(ms);
return ms.ToArray();
}
}
}
}