PR #219 but neater and allowing debugging in VS

This commit is contained in:
dexy 2024-07-11 10:51:17 +10:00
parent 86044e2c89
commit bad84d7bdc
17 changed files with 117 additions and 92 deletions

View File

@ -3,7 +3,9 @@ using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using System.Drawing; using System.Drawing;
using System.Globalization; using System.Globalization;
using System.IO;
using System.Linq; using System.Linq;
using System.Reflection;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
@ -14,6 +16,29 @@ namespace CodeWalker
{ {
public static class PathUtil
{
public static string AppPath = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
public static string WorkPath = Directory.GetCurrentDirectory();
public static string GetFilePath(string appRelativePath)
{
var path = Path.Combine(AppPath, appRelativePath);
if (File.Exists(path)) return path;
path = Path.Combine(WorkPath, appRelativePath);
return path;
}
public static byte[] ReadAllBytes(string appRelativePath)
{
var path = GetFilePath(appRelativePath);
return File.ReadAllBytes(path);
}
}
public static class TextUtil public static class TextUtil
{ {

View File

@ -184,34 +184,34 @@ namespace CodeWalker.Rendering
public BasicShader(Device device) public BasicShader(Device device)
{ {
byte[] vspnctbytes = File.ReadAllBytes("Shaders\\BasicVS_PNCT.cso"); byte[] vspnctbytes = PathUtil.ReadAllBytes("Shaders\\BasicVS_PNCT.cso");
byte[] vspncttbytes = File.ReadAllBytes("Shaders\\BasicVS_PNCTT.cso"); byte[] vspncttbytes = PathUtil.ReadAllBytes("Shaders\\BasicVS_PNCTT.cso");
byte[] vspnctttbytes = File.ReadAllBytes("Shaders\\BasicVS_PNCTTT.cso"); byte[] vspnctttbytes = PathUtil.ReadAllBytes("Shaders\\BasicVS_PNCTTT.cso");
byte[] vspncctbytes = File.ReadAllBytes("Shaders\\BasicVS_PNCCT.cso"); byte[] vspncctbytes = PathUtil.ReadAllBytes("Shaders\\BasicVS_PNCCT.cso");
byte[] vspnccttbytes = File.ReadAllBytes("Shaders\\BasicVS_PNCCTT.cso"); byte[] vspnccttbytes = PathUtil.ReadAllBytes("Shaders\\BasicVS_PNCCTT.cso");
byte[] vspncctttbytes = File.ReadAllBytes("Shaders\\BasicVS_PNCCTTT.cso"); byte[] vspncctttbytes = PathUtil.ReadAllBytes("Shaders\\BasicVS_PNCCTTT.cso");
byte[] vspnctxbytes = File.ReadAllBytes("Shaders\\BasicVS_PNCTX.cso"); byte[] vspnctxbytes = PathUtil.ReadAllBytes("Shaders\\BasicVS_PNCTX.cso");
byte[] vspncctxbytes = File.ReadAllBytes("Shaders\\BasicVS_PNCCTX.cso"); byte[] vspncctxbytes = PathUtil.ReadAllBytes("Shaders\\BasicVS_PNCCTX.cso");
byte[] vspncttxbytes = File.ReadAllBytes("Shaders\\BasicVS_PNCTTX.cso"); byte[] vspncttxbytes = PathUtil.ReadAllBytes("Shaders\\BasicVS_PNCTTX.cso");
byte[] vspnccttxbytes = File.ReadAllBytes("Shaders\\BasicVS_PNCCTTX.cso"); byte[] vspnccttxbytes = PathUtil.ReadAllBytes("Shaders\\BasicVS_PNCCTTX.cso");
byte[] vspnctttxbytes = File.ReadAllBytes("Shaders\\BasicVS_PNCTTTX.cso"); byte[] vspnctttxbytes = PathUtil.ReadAllBytes("Shaders\\BasicVS_PNCTTTX.cso");
byte[] vspncctttxbytes = File.ReadAllBytes("Shaders\\BasicVS_PNCCTTTX.cso"); byte[] vspncctttxbytes = PathUtil.ReadAllBytes("Shaders\\BasicVS_PNCCTTTX.cso");
byte[] vspbbnctbytes = File.ReadAllBytes("Shaders\\BasicVS_PBBNCT.cso"); byte[] vspbbnctbytes = PathUtil.ReadAllBytes("Shaders\\BasicVS_PBBNCT.cso");
byte[] vspbbnctxbytes = File.ReadAllBytes("Shaders\\BasicVS_PBBNCTX.cso"); byte[] vspbbnctxbytes = PathUtil.ReadAllBytes("Shaders\\BasicVS_PBBNCTX.cso");
byte[] vspbbncttbytes = File.ReadAllBytes("Shaders\\BasicVS_PBBNCTT.cso"); byte[] vspbbncttbytes = PathUtil.ReadAllBytes("Shaders\\BasicVS_PBBNCTT.cso");
byte[] vspbbnctttbytes = File.ReadAllBytes("Shaders\\BasicVS_PBBNCTTT.cso"); byte[] vspbbnctttbytes = PathUtil.ReadAllBytes("Shaders\\BasicVS_PBBNCTTT.cso");
byte[] vspbbncctbytes = File.ReadAllBytes("Shaders\\BasicVS_PBBNCCT.cso"); byte[] vspbbncctbytes = PathUtil.ReadAllBytes("Shaders\\BasicVS_PBBNCCT.cso");
byte[] vspbbncctxbytes = File.ReadAllBytes("Shaders\\BasicVS_PBBNCCTX.cso"); byte[] vspbbncctxbytes = PathUtil.ReadAllBytes("Shaders\\BasicVS_PBBNCCTX.cso");
byte[] vspbbnccttxbytes = File.ReadAllBytes("Shaders\\BasicVS_PBBNCCTTX.cso"); byte[] vspbbnccttxbytes = PathUtil.ReadAllBytes("Shaders\\BasicVS_PBBNCCTTX.cso");
byte[] vspbbncttxbytes = File.ReadAllBytes("Shaders\\BasicVS_PBBNCTTX.cso"); byte[] vspbbncttxbytes = PathUtil.ReadAllBytes("Shaders\\BasicVS_PBBNCTTX.cso");
byte[] vsboxbytes = File.ReadAllBytes("Shaders\\BasicVS_Box.cso"); byte[] vsboxbytes = PathUtil.ReadAllBytes("Shaders\\BasicVS_Box.cso");
byte[] vsspherebytes = File.ReadAllBytes("Shaders\\BasicVS_Sphere.cso"); byte[] vsspherebytes = PathUtil.ReadAllBytes("Shaders\\BasicVS_Sphere.cso");
byte[] vscapsulebytes = File.ReadAllBytes("Shaders\\BasicVS_Capsule.cso"); byte[] vscapsulebytes = PathUtil.ReadAllBytes("Shaders\\BasicVS_Capsule.cso");
byte[] vscylinderbytes = File.ReadAllBytes("Shaders\\BasicVS_Cylinder.cso"); byte[] vscylinderbytes = PathUtil.ReadAllBytes("Shaders\\BasicVS_Cylinder.cso");
byte[] psbytes = File.ReadAllBytes("Shaders\\BasicPS.cso"); byte[] psbytes = PathUtil.ReadAllBytes("Shaders\\BasicPS.cso");
byte[] psdefbytes = File.ReadAllBytes("Shaders\\BasicPS_Deferred.cso"); byte[] psdefbytes = PathUtil.ReadAllBytes("Shaders\\BasicPS_Deferred.cso");
basicvspnct = new VertexShader(device, vspnctbytes); basicvspnct = new VertexShader(device, vspnctbytes);
basicvspnctt = new VertexShader(device, vspncttbytes); basicvspnctt = new VertexShader(device, vspncttbytes);

View File

@ -71,9 +71,9 @@ namespace CodeWalker.Rendering
public BoundsShader(Device device) public BoundsShader(Device device)
{ {
byte[] spherevsbytes = File.ReadAllBytes("Shaders\\BoundingSphereVS.cso"); byte[] spherevsbytes = PathUtil.ReadAllBytes("Shaders\\BoundingSphereVS.cso");
byte[] boxvsbytes = File.ReadAllBytes("Shaders\\BoundingBoxVS.cso"); byte[] boxvsbytes = PathUtil.ReadAllBytes("Shaders\\BoundingBoxVS.cso");
byte[] psbytes = File.ReadAllBytes("Shaders\\BoundsPS.cso"); byte[] psbytes = PathUtil.ReadAllBytes("Shaders\\BoundsPS.cso");
spherevs = new VertexShader(device, spherevsbytes); spherevs = new VertexShader(device, spherevsbytes);
boxvs = new VertexShader(device, boxvsbytes); boxvs = new VertexShader(device, boxvsbytes);

View File

@ -88,9 +88,9 @@ namespace CodeWalker.Rendering
public CableShader(Device device) public CableShader(Device device)
{ {
byte[] vsbytes = File.ReadAllBytes("Shaders\\CableVS.cso"); byte[] vsbytes = PathUtil.ReadAllBytes("Shaders\\CableVS.cso");
byte[] psbytes = File.ReadAllBytes("Shaders\\CablePS.cso"); byte[] psbytes = PathUtil.ReadAllBytes("Shaders\\CablePS.cso");
byte[] psdefbytes = File.ReadAllBytes("Shaders\\CablePS_Deferred.cso"); byte[] psdefbytes = PathUtil.ReadAllBytes("Shaders\\CablePS_Deferred.cso");
vs = new VertexShader(device, vsbytes); vs = new VertexShader(device, vsbytes);
ps = new PixelShader(device, psbytes); ps = new PixelShader(device, psbytes);

View File

@ -106,8 +106,8 @@ namespace CodeWalker.Rendering
public CloudsShader(Device device) public CloudsShader(Device device)
{ {
byte[] vsbytes = File.ReadAllBytes("Shaders\\CloudsVS.cso"); byte[] vsbytes = PathUtil.ReadAllBytes("Shaders\\CloudsVS.cso");
byte[] psbytes = File.ReadAllBytes("Shaders\\CloudsPS.cso"); byte[] psbytes = PathUtil.ReadAllBytes("Shaders\\CloudsPS.cso");
vs = new VertexShader(device, vsbytes); vs = new VertexShader(device, vsbytes);
ps = new PixelShader(device, psbytes); ps = new PixelShader(device, psbytes);

View File

@ -128,17 +128,17 @@ namespace CodeWalker.Rendering
{ {
var device = dxman.device; var device = dxman.device;
byte[] bDirLightVS = File.ReadAllBytes("Shaders\\DirLightVS.cso"); byte[] bDirLightVS = PathUtil.ReadAllBytes("Shaders\\DirLightVS.cso");
byte[] bDirLightPS = File.ReadAllBytes("Shaders\\DirLightPS.cso"); byte[] bDirLightPS = PathUtil.ReadAllBytes("Shaders\\DirLightPS.cso");
byte[] bDirLightMSPS = File.ReadAllBytes("Shaders\\DirLightPS_MS.cso"); byte[] bDirLightMSPS = PathUtil.ReadAllBytes("Shaders\\DirLightPS_MS.cso");
byte[] bLodLightVS = File.ReadAllBytes("Shaders\\LodLightsVS.cso"); byte[] bLodLightVS = PathUtil.ReadAllBytes("Shaders\\LodLightsVS.cso");
byte[] bLodLightPS = File.ReadAllBytes("Shaders\\LodLightsPS.cso"); byte[] bLodLightPS = PathUtil.ReadAllBytes("Shaders\\LodLightsPS.cso");
byte[] bLodLightMSPS = File.ReadAllBytes("Shaders\\LodLightsPS_MS.cso"); byte[] bLodLightMSPS = PathUtil.ReadAllBytes("Shaders\\LodLightsPS_MS.cso");
byte[] bLightVS = File.ReadAllBytes("Shaders\\LightVS.cso"); byte[] bLightVS = PathUtil.ReadAllBytes("Shaders\\LightVS.cso");
byte[] bLightPS = File.ReadAllBytes("Shaders\\LightPS.cso"); byte[] bLightPS = PathUtil.ReadAllBytes("Shaders\\LightPS.cso");
byte[] bLightMSPS = File.ReadAllBytes("Shaders\\LightPS_MS.cso"); byte[] bLightMSPS = PathUtil.ReadAllBytes("Shaders\\LightPS_MS.cso");
byte[] bFinalVS = File.ReadAllBytes("Shaders\\PPFinalPassVS.cso"); byte[] bFinalVS = PathUtil.ReadAllBytes("Shaders\\PPFinalPassVS.cso");
byte[] bSSAAPS = File.ReadAllBytes("Shaders\\PPSSAAPS.cso"); byte[] bSSAAPS = PathUtil.ReadAllBytes("Shaders\\PPSSAAPS.cso");
DirLightVS = new VertexShader(device, bDirLightVS); DirLightVS = new VertexShader(device, bDirLightVS);
DirLightPS = new PixelShader(device, bDirLightPS); DirLightPS = new PixelShader(device, bDirLightPS);

View File

@ -41,8 +41,8 @@ namespace CodeWalker.Rendering
public DistantLightsShader(Device device) public DistantLightsShader(Device device)
{ {
byte[] vsbytes = File.ReadAllBytes("Shaders\\DistantLightsVS.cso"); byte[] vsbytes = PathUtil.ReadAllBytes("Shaders\\DistantLightsVS.cso");
byte[] psbytes = File.ReadAllBytes("Shaders\\DistantLightsPS.cso"); byte[] psbytes = PathUtil.ReadAllBytes("Shaders\\DistantLightsPS.cso");
lightsvs = new VertexShader(device, vsbytes); lightsvs = new VertexShader(device, vsbytes);
lightsps = new PixelShader(device, psbytes); lightsps = new PixelShader(device, psbytes);

View File

@ -46,8 +46,8 @@ namespace CodeWalker.Rendering
public MarkerShader(Device device) public MarkerShader(Device device)
{ {
byte[] vsbytes = File.ReadAllBytes("Shaders\\MarkerVS.cso"); byte[] vsbytes = PathUtil.ReadAllBytes("Shaders\\MarkerVS.cso");
byte[] psbytes = File.ReadAllBytes("Shaders\\MarkerPS.cso"); byte[] psbytes = PathUtil.ReadAllBytes("Shaders\\MarkerPS.cso");
markervs = new VertexShader(device, vsbytes); markervs = new VertexShader(device, vsbytes);
markerps = new PixelShader(device, psbytes); markerps = new PixelShader(device, psbytes);

View File

@ -46,11 +46,11 @@ namespace CodeWalker.Rendering
public PathShader(Device device) public PathShader(Device device)
{ {
byte[] boxvsbytes = File.ReadAllBytes("Shaders\\PathBoxVS.cso"); byte[] boxvsbytes = PathUtil.ReadAllBytes("Shaders\\PathBoxVS.cso");
byte[] boxpsbytes = File.ReadAllBytes("Shaders\\PathBoxPS.cso"); byte[] boxpsbytes = PathUtil.ReadAllBytes("Shaders\\PathBoxPS.cso");
byte[] dynvsbytes = File.ReadAllBytes("Shaders\\PathDynVS.cso"); byte[] dynvsbytes = PathUtil.ReadAllBytes("Shaders\\PathDynVS.cso");
byte[] vsbytes = File.ReadAllBytes("Shaders\\PathVS.cso"); byte[] vsbytes = PathUtil.ReadAllBytes("Shaders\\PathVS.cso");
byte[] psbytes = File.ReadAllBytes("Shaders\\PathPS.cso"); byte[] psbytes = PathUtil.ReadAllBytes("Shaders\\PathPS.cso");
boxvs = new VertexShader(device, boxvsbytes); boxvs = new VertexShader(device, boxvsbytes);

View File

@ -186,14 +186,14 @@ namespace CodeWalker.Rendering
{ {
var device = dxman.device; var device = dxman.device;
byte[] bReduceTo1DCS = File.ReadAllBytes("Shaders\\PPReduceTo1DCS.cso"); byte[] bReduceTo1DCS = PathUtil.ReadAllBytes("Shaders\\PPReduceTo1DCS.cso");
byte[] bReduceTo0DCS = File.ReadAllBytes("Shaders\\PPReduceTo0DCS.cso"); byte[] bReduceTo0DCS = PathUtil.ReadAllBytes("Shaders\\PPReduceTo0DCS.cso");
byte[] bLumBlendCS = File.ReadAllBytes("Shaders\\PPLumBlendCS.cso"); byte[] bLumBlendCS = PathUtil.ReadAllBytes("Shaders\\PPLumBlendCS.cso");
byte[] bBloomFilterBPHCS = File.ReadAllBytes("Shaders\\PPBloomFilterBPHCS.cso"); byte[] bBloomFilterBPHCS = PathUtil.ReadAllBytes("Shaders\\PPBloomFilterBPHCS.cso");
byte[] bBloomFilterVCS = File.ReadAllBytes("Shaders\\PPBloomFilterVCS.cso"); byte[] bBloomFilterVCS = PathUtil.ReadAllBytes("Shaders\\PPBloomFilterVCS.cso");
byte[] bCopyPixelsPS = File.ReadAllBytes("Shaders\\PPCopyPixelsPS.cso"); byte[] bCopyPixelsPS = PathUtil.ReadAllBytes("Shaders\\PPCopyPixelsPS.cso");
byte[] bFinalPassVS = File.ReadAllBytes("Shaders\\PPFinalPassVS.cso"); byte[] bFinalPassVS = PathUtil.ReadAllBytes("Shaders\\PPFinalPassVS.cso");
byte[] bFinalPassPS = File.ReadAllBytes("Shaders\\PPFinalPassPS.cso"); byte[] bFinalPassPS = PathUtil.ReadAllBytes("Shaders\\PPFinalPassPS.cso");
ReduceTo1DCS = new ComputeShader(device, bReduceTo1DCS); ReduceTo1DCS = new ComputeShader(device, bReduceTo1DCS);
ReduceTo0DCS = new ComputeShader(device, bReduceTo0DCS); ReduceTo0DCS = new ComputeShader(device, bReduceTo0DCS);

View File

@ -81,9 +81,9 @@ namespace CodeWalker.Rendering
public ShadowShader(Device device) public ShadowShader(Device device)
{ {
byte[] vsbytes = File.ReadAllBytes("Shaders\\ShadowVS.cso"); byte[] vsbytes = PathUtil.ReadAllBytes("Shaders\\ShadowVS.cso");
byte[] vssbytes = File.ReadAllBytes("Shaders\\ShadowVS_Skin.cso"); byte[] vssbytes = PathUtil.ReadAllBytes("Shaders\\ShadowVS_Skin.cso");
byte[] psbytes = File.ReadAllBytes("Shaders\\ShadowPS.cso"); byte[] psbytes = PathUtil.ReadAllBytes("Shaders\\ShadowPS.cso");
shadowvs = new VertexShader(device, vsbytes); shadowvs = new VertexShader(device, vsbytes);
shadowvs_skin = new VertexShader(device, vssbytes); shadowvs_skin = new VertexShader(device, vssbytes);

View File

@ -131,12 +131,12 @@ namespace CodeWalker.Rendering
public SkydomeShader(Device device) public SkydomeShader(Device device)
{ {
byte[] skyvsbytes = File.ReadAllBytes("Shaders\\SkydomeVS.cso"); byte[] skyvsbytes = PathUtil.ReadAllBytes("Shaders\\SkydomeVS.cso");
byte[] skypsbytes = File.ReadAllBytes("Shaders\\SkydomePS.cso"); byte[] skypsbytes = PathUtil.ReadAllBytes("Shaders\\SkydomePS.cso");
byte[] sunvsbytes = File.ReadAllBytes("Shaders\\SkySunVS.cso"); byte[] sunvsbytes = PathUtil.ReadAllBytes("Shaders\\SkySunVS.cso");
byte[] sunpsbytes = File.ReadAllBytes("Shaders\\SkySunPS.cso"); byte[] sunpsbytes = PathUtil.ReadAllBytes("Shaders\\SkySunPS.cso");
byte[] moonvsbytes = File.ReadAllBytes("Shaders\\SkyMoonVS.cso"); byte[] moonvsbytes = PathUtil.ReadAllBytes("Shaders\\SkyMoonVS.cso");
byte[] moonpsbytes = File.ReadAllBytes("Shaders\\SkyMoonPS.cso"); byte[] moonpsbytes = PathUtil.ReadAllBytes("Shaders\\SkyMoonPS.cso");
skyvs = new VertexShader(device, skyvsbytes); skyvs = new VertexShader(device, skyvsbytes);
skyps = new PixelShader(device, skypsbytes); skyps = new PixelShader(device, skypsbytes);

View File

@ -101,15 +101,15 @@ namespace CodeWalker.Rendering
public TerrainShader(Device device) public TerrainShader(Device device)
{ {
byte[] vspncct = File.ReadAllBytes("Shaders\\TerrainVS_PNCCT.cso"); byte[] vspncct = PathUtil.ReadAllBytes("Shaders\\TerrainVS_PNCCT.cso");
byte[] vspncctt = File.ReadAllBytes("Shaders\\TerrainVS_PNCCTT.cso"); byte[] vspncctt = PathUtil.ReadAllBytes("Shaders\\TerrainVS_PNCCTT.cso");
byte[] vspnccttx = File.ReadAllBytes("Shaders\\TerrainVS_PNCCTTX.cso"); byte[] vspnccttx = PathUtil.ReadAllBytes("Shaders\\TerrainVS_PNCCTTX.cso");
byte[] vspncctttx = File.ReadAllBytes("Shaders\\TerrainVS_PNCCTTTX.cso"); byte[] vspncctttx = PathUtil.ReadAllBytes("Shaders\\TerrainVS_PNCCTTTX.cso");
byte[] vspncctx = File.ReadAllBytes("Shaders\\TerrainVS_PNCCTX.cso"); byte[] vspncctx = PathUtil.ReadAllBytes("Shaders\\TerrainVS_PNCCTX.cso");
byte[] vspnctttx = File.ReadAllBytes("Shaders\\TerrainVS_PNCTTTX.cso"); byte[] vspnctttx = PathUtil.ReadAllBytes("Shaders\\TerrainVS_PNCTTTX.cso");
byte[] vspncttx = File.ReadAllBytes("Shaders\\TerrainVS_PNCTTX.cso"); byte[] vspncttx = PathUtil.ReadAllBytes("Shaders\\TerrainVS_PNCTTX.cso");
byte[] psbytes = File.ReadAllBytes("Shaders\\TerrainPS.cso"); byte[] psbytes = PathUtil.ReadAllBytes("Shaders\\TerrainPS.cso");
byte[] psdefbytes = File.ReadAllBytes("Shaders\\TerrainPS_Deferred.cso"); byte[] psdefbytes = PathUtil.ReadAllBytes("Shaders\\TerrainPS_Deferred.cso");
pncctvs = new VertexShader(device, vspncct); pncctvs = new VertexShader(device, vspncct);
pnccttvs = new VertexShader(device, vspncctt); pnccttvs = new VertexShader(device, vspncctt);

View File

@ -77,9 +77,9 @@ namespace CodeWalker.Rendering
public TreesLodShader(Device device) public TreesLodShader(Device device)
{ {
byte[] vsbytes = File.ReadAllBytes("Shaders\\TreesLodVS.cso"); byte[] vsbytes = PathUtil.ReadAllBytes("Shaders\\TreesLodVS.cso");
byte[] psbytes = File.ReadAllBytes("Shaders\\TreesLodPS.cso"); byte[] psbytes = PathUtil.ReadAllBytes("Shaders\\TreesLodPS.cso");
byte[] psdefbytes = File.ReadAllBytes("Shaders\\TreesLodPS_Deferred.cso"); byte[] psdefbytes = PathUtil.ReadAllBytes("Shaders\\TreesLodPS_Deferred.cso");
vs = new VertexShader(device, vsbytes); vs = new VertexShader(device, vsbytes);
ps = new PixelShader(device, psbytes); ps = new PixelShader(device, psbytes);

View File

@ -121,12 +121,12 @@ namespace CodeWalker.Rendering
public WaterShader(Device device) public WaterShader(Device device)
{ {
byte[] vsptbytes = File.ReadAllBytes("Shaders\\WaterVS_PT.cso"); byte[] vsptbytes = PathUtil.ReadAllBytes("Shaders\\WaterVS_PT.cso");
byte[] vspctbytes = File.ReadAllBytes("Shaders\\WaterVS_PCT.cso"); byte[] vspctbytes = PathUtil.ReadAllBytes("Shaders\\WaterVS_PCT.cso");
byte[] vspnctbytes = File.ReadAllBytes("Shaders\\WaterVS_PNCT.cso"); byte[] vspnctbytes = PathUtil.ReadAllBytes("Shaders\\WaterVS_PNCT.cso");
byte[] vspnctxbytes = File.ReadAllBytes("Shaders\\WaterVS_PNCTX.cso"); byte[] vspnctxbytes = PathUtil.ReadAllBytes("Shaders\\WaterVS_PNCTX.cso");
byte[] psbytes = File.ReadAllBytes("Shaders\\WaterPS.cso"); byte[] psbytes = PathUtil.ReadAllBytes("Shaders\\WaterPS.cso");
byte[] psdefbytes = File.ReadAllBytes("Shaders\\WaterPS_Deferred.cso"); byte[] psdefbytes = PathUtil.ReadAllBytes("Shaders\\WaterPS_Deferred.cso");
vspt = new VertexShader(device, vsptbytes); vspt = new VertexShader(device, vsptbytes);

View File

@ -39,8 +39,8 @@ namespace CodeWalker.Rendering
public WidgetShader(Device device) public WidgetShader(Device device)
{ {
byte[] vsbytes = File.ReadAllBytes("Shaders\\WidgetVS.cso"); byte[] vsbytes = PathUtil.ReadAllBytes("Shaders\\WidgetVS.cso");
byte[] psbytes = File.ReadAllBytes("Shaders\\WidgetPS.cso"); byte[] psbytes = PathUtil.ReadAllBytes("Shaders\\WidgetPS.cso");
vs = new VertexShader(device, vsbytes); vs = new VertexShader(device, vsbytes);
ps = new PixelShader(device, psbytes); ps = new PixelShader(device, psbytes);

View File

@ -314,7 +314,7 @@ namespace CodeWalker
private MapIcon AddIcon(string name, string filename, int texw, int texh, float centerx, float centery, float scale) private MapIcon AddIcon(string name, string filename, int texw, int texh, float centerx, float centery, float scale)
{ {
string filepath = "icons\\" + filename; string filepath = PathUtil.GetFilePath("icons\\" + filename);
try try
{ {
MapIcon mi = new MapIcon(name, filepath, texw, texh, centerx, centery, scale); MapIcon mi = new MapIcon(name, filepath, texw, texh, centerx, centery, scale);