Added builder
Added shader importer
This commit is contained in:
9
Nerfed.Builder/Builder/Importers/RawFileImporter.cs
Normal file
9
Nerfed.Builder/Builder/Importers/RawFileImporter.cs
Normal file
@ -0,0 +1,9 @@
|
||||
namespace Nerfed.Builder;
|
||||
|
||||
public class RawFileImporter : IImporter
|
||||
{
|
||||
public void Import(string inFile, string outFile)
|
||||
{
|
||||
FileUtil.Copy(inFile, outFile);
|
||||
}
|
||||
}
|
33
Nerfed.Builder/Builder/Importers/ShaderImporter.cs
Normal file
33
Nerfed.Builder/Builder/Importers/ShaderImporter.cs
Normal file
@ -0,0 +1,33 @@
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace Nerfed.Builder;
|
||||
|
||||
public class ShaderImporter : IImporter
|
||||
{
|
||||
public void Import(string inFile, string outFile)
|
||||
{
|
||||
using (Process proc = new Process())
|
||||
{
|
||||
string glslc;
|
||||
if (OperatingSystem.IsWindows())
|
||||
{
|
||||
glslc = "Win64/glslc.exe";
|
||||
}
|
||||
else if (OperatingSystem.IsLinux())
|
||||
{
|
||||
glslc = "Linux/glslc";
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new PlatformNotSupportedException("No shader compiler found for current platform");
|
||||
}
|
||||
|
||||
proc.StartInfo.FileName = glslc;
|
||||
proc.StartInfo.Arguments = @$"""{inFile}"" -o ""{outFile}"" -c";
|
||||
proc.StartInfo.CreateNoWindow = true;
|
||||
proc.StartInfo.UseShellExecute = false;
|
||||
proc.Start();
|
||||
proc.WaitForExit();
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user