2020-08-05 03:50:44 +00:00
|
|
|
using System.IO;
|
|
|
|
|
|
|
|
namespace Kav
|
|
|
|
{
|
|
|
|
internal class Resources
|
|
|
|
{
|
2020-10-01 19:46:25 +00:00
|
|
|
public static byte[] DeferredPBR_AmbientLightEffect
|
|
|
|
{
|
|
|
|
get
|
|
|
|
{
|
|
|
|
if (ambientLightEffect == null)
|
|
|
|
{
|
2020-10-19 10:01:37 +00:00
|
|
|
ambientLightEffect = GetResource("DeferredPBR_AmbientLightEffect.fxb");
|
2020-10-01 19:46:25 +00:00
|
|
|
}
|
|
|
|
return ambientLightEffect;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
public static byte[] DeferredPBR_PointLightEffect
|
|
|
|
{
|
|
|
|
get
|
|
|
|
{
|
|
|
|
if (pointLightEffect == null)
|
|
|
|
{
|
2020-10-19 10:01:37 +00:00
|
|
|
pointLightEffect = GetResource("DeferredPBR_PointLightEffect.fxb");
|
2020-10-01 19:46:25 +00:00
|
|
|
}
|
|
|
|
return pointLightEffect;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public static byte[] DeferredPBR_DirectionalLightEffect
|
|
|
|
{
|
|
|
|
get
|
|
|
|
{
|
|
|
|
if (directionalLightEffect == null)
|
|
|
|
{
|
2020-10-19 10:01:37 +00:00
|
|
|
directionalLightEffect = GetResource("DeferredPBR_DirectionalLightEffect.fxb");
|
2020-10-01 19:46:25 +00:00
|
|
|
}
|
|
|
|
return directionalLightEffect;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-08-27 18:14:17 +00:00
|
|
|
public static byte[] DeferredPBR_GBufferEffect
|
|
|
|
{
|
|
|
|
get
|
|
|
|
{
|
|
|
|
if (gBufferEffect == null)
|
|
|
|
{
|
2020-10-19 10:01:37 +00:00
|
|
|
gBufferEffect = GetResource("DeferredPBR_GBufferEffect.fxb");
|
2020-08-27 18:14:17 +00:00
|
|
|
}
|
|
|
|
return gBufferEffect;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-10-01 19:46:25 +00:00
|
|
|
public static byte[] ToneMapEffect
|
|
|
|
{
|
|
|
|
get
|
|
|
|
{
|
|
|
|
if (toneMapEffect == null)
|
|
|
|
{
|
2020-10-19 10:01:37 +00:00
|
|
|
toneMapEffect = GetResource("ToneMapEffect.fxb");
|
2020-10-01 19:46:25 +00:00
|
|
|
}
|
|
|
|
return toneMapEffect;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-10-01 21:52:19 +00:00
|
|
|
public static byte[] Deferred_ToonEffect
|
|
|
|
{
|
|
|
|
get
|
|
|
|
{
|
|
|
|
if (deferredToonEffect == null)
|
|
|
|
{
|
2020-10-19 10:01:37 +00:00
|
|
|
deferredToonEffect = GetResource("Deferred_ToonEffect.fxb");
|
2020-10-01 21:52:19 +00:00
|
|
|
}
|
|
|
|
return deferredToonEffect;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-08-27 18:14:17 +00:00
|
|
|
public static byte[] DeferredPBREffect
|
|
|
|
{
|
|
|
|
get
|
|
|
|
{
|
|
|
|
if (deferredPBREffect == null)
|
|
|
|
{
|
2020-10-19 10:01:37 +00:00
|
|
|
deferredPBREffect = GetResource("DeferredPBREffect.fxb");
|
2020-08-27 18:14:17 +00:00
|
|
|
}
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-12-08 10:49:18 +00:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-12-09 00:02:58 +00:00
|
|
|
public static byte[] LinearDepthEffectInstanced
|
|
|
|
{
|
|
|
|
get
|
|
|
|
{
|
|
|
|
if (linearDepthEffectInstanced == null)
|
|
|
|
{
|
|
|
|
linearDepthEffectInstanced = GetResource("LinearDepthEffectInstanced.fxb");
|
|
|
|
}
|
|
|
|
return linearDepthEffectInstanced;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-10-19 10:01:37 +00:00
|
|
|
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-12-09 20:44:53 +00:00
|
|
|
public static byte[] PaletteCrushEffect
|
|
|
|
{
|
|
|
|
get
|
|
|
|
{
|
|
|
|
if (paletteCrushEffect == null)
|
|
|
|
{
|
|
|
|
paletteCrushEffect = GetResource("PaletteCrushEffect.fxb");
|
|
|
|
}
|
|
|
|
return paletteCrushEffect;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-10-19 10:01:37 +00:00
|
|
|
public static byte[] UnitCubeModel
|
|
|
|
{
|
|
|
|
get
|
|
|
|
{
|
|
|
|
if (unitCubeModel == null)
|
|
|
|
{
|
|
|
|
unitCubeModel = GetResource("UnitCube.glb");
|
|
|
|
}
|
|
|
|
return unitCubeModel;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-12-10 00:10:53 +00:00
|
|
|
public static byte[] UnitSphereModel
|
|
|
|
{
|
|
|
|
get
|
|
|
|
{
|
|
|
|
if (unitSphereModel == null)
|
|
|
|
{
|
|
|
|
unitSphereModel = GetResource("UnitSphere.glb");
|
|
|
|
}
|
|
|
|
return unitSphereModel;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-10-01 19:46:25 +00:00
|
|
|
private static byte[] ambientLightEffect;
|
|
|
|
private static byte[] pointLightEffect;
|
|
|
|
private static byte[] directionalLightEffect;
|
2020-08-27 18:14:17 +00:00
|
|
|
private static byte[] gBufferEffect;
|
2020-10-01 19:46:25 +00:00
|
|
|
private static byte[] toneMapEffect;
|
2020-10-01 21:52:19 +00:00
|
|
|
private static byte[] deferredToonEffect;
|
2020-08-27 18:14:17 +00:00
|
|
|
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;
|
2020-12-08 10:49:18 +00:00
|
|
|
private static byte[] simpleDepthEffectInstanced;
|
2020-10-19 10:01:37 +00:00
|
|
|
private static byte[] linearDepthEffect;
|
2020-12-09 00:02:58 +00:00
|
|
|
private static byte[] linearDepthEffectInstanced;
|
2020-10-19 10:01:37 +00:00
|
|
|
private static byte[] skyboxEffect;
|
2020-12-06 03:47:01 +00:00
|
|
|
private static byte[] diffuseLitSpriteEffect;
|
2020-12-09 20:44:53 +00:00
|
|
|
private static byte[] paletteCrushEffect;
|
2020-10-19 10:01:37 +00:00
|
|
|
|
|
|
|
private static byte[] unitCubeModel;
|
2020-12-10 00:10:53 +00:00
|
|
|
private static byte[] unitSphereModel;
|
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();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|