-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
146 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio Version 16 | ||
VisualStudioVersion = 16.0.29613.14 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Uvee", "Uvee\Uvee.csproj", "{BEC4DD0B-9B2B-461A-A5EB-C691CE0AFCF1}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{BEC4DD0B-9B2B-461A-A5EB-C691CE0AFCF1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{BEC4DD0B-9B2B-461A-A5EB-C691CE0AFCF1}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{BEC4DD0B-9B2B-461A-A5EB-C691CE0AFCF1}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{BEC4DD0B-9B2B-461A-A5EB-C691CE0AFCF1}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {B0354C1D-23F1-4746-BC80-B15C75CD8163} | ||
EndGlobalSection | ||
EndGlobal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
using Fantome.Libraries.League.IO.SimpleSkin; | ||
using SixLabors.ImageSharp; | ||
using SixLabors.ImageSharp.PixelFormats; | ||
using SixLabors.ImageSharp.Processing; | ||
using SixLabors.Primitives; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
|
||
namespace Uvee | ||
{ | ||
public static class Processor | ||
{ | ||
private static readonly SolidBrush BRUSH = Brushes.Solid(Color.White); | ||
|
||
public static void Process(string fileLocation, SKNFile skn) | ||
{ | ||
string exportDirectory = string.Format(@"{0}\Uvee_{1}", Path.GetDirectoryName(fileLocation), Path.GetFileNameWithoutExtension(fileLocation)); | ||
Directory.CreateDirectory(exportDirectory); | ||
|
||
foreach (SKNSubmesh submesh in skn.Submeshes) | ||
{ | ||
Image image = CreateImage(); | ||
List<ushort> indices = submesh.GetNormalizedIndices(); | ||
|
||
//Loop through all submesh faces and draw the lines for them using vertex UV | ||
for (int i = 0; i < indices.Count;) | ||
{ | ||
SKNVertex vertex1 = submesh.Vertices[indices[i++]]; | ||
SKNVertex vertex2 = submesh.Vertices[indices[i++]]; | ||
SKNVertex vertex3 = submesh.Vertices[indices[i++]]; | ||
|
||
PointF[] points = new PointF[] | ||
{ | ||
new PointF(1024 * vertex1.UV.X, 1024 * vertex1.UV.Y), | ||
new PointF(1024 * vertex2.UV.X, 1024 * vertex2.UV.Y), | ||
new PointF(1024 * vertex3.UV.X, 1024 * vertex3.UV.Y), | ||
new PointF(1024 * vertex1.UV.X, 1024 * vertex1.UV.Y) //4th point to close the edge loop | ||
}; | ||
|
||
DrawLines(image, points); | ||
} | ||
|
||
string submeshLocation = string.Format(@"{0}\{1}.png", exportDirectory, submesh.Name); | ||
image.SaveAsPng(File.Create(submeshLocation)); | ||
} | ||
} | ||
|
||
private static Image CreateImage() | ||
{ | ||
return new Image<Rgba32>(1024, 1024); | ||
} | ||
private static void DrawLines(Image image, PointF[] points) | ||
{ | ||
image.Mutate(x => x.DrawLines(BRUSH, 0.75f, points)); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
using System; | ||
using Fantome.Libraries.League.Helpers; | ||
using System.IO; | ||
using Fantome.Libraries.League.IO.SimpleSkin; | ||
|
||
namespace Uvee | ||
{ | ||
#warning Build: dotnet publish -c Release -r win-x86 --self-contained true /p:PublishSingleFile=true /p:TrimUnusedDependencies=true | ||
class Program | ||
{ | ||
static void Main(string[] args) | ||
{ | ||
if (args.Length == 1) | ||
{ | ||
if (File.Exists(args[0])) | ||
{ | ||
LeagueFileType meshType = Utilities.GetExtensionType(Path.GetExtension(args[0])); | ||
|
||
if(meshType == LeagueFileType.SKN) | ||
{ | ||
Processor.Process(args[0], new SKNFile(args[0])); | ||
} | ||
else | ||
{ | ||
WriteError("File type must be SKN"); | ||
} | ||
|
||
} | ||
else | ||
{ | ||
WriteError("File does not exist"); | ||
} | ||
} | ||
else | ||
{ | ||
WriteError("Please input SKN file"); | ||
} | ||
} | ||
|
||
private static void WriteError(string message) | ||
{ | ||
Console.ForegroundColor = ConsoleColor.Red; | ||
Console.WriteLine(message); | ||
Console.ResetColor(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>netcoreapp3.1</TargetFramework> | ||
<AssemblyName>Uvee</AssemblyName> | ||
<RootNamespace>Uvee</RootNamespace> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Fantome.Libraries.League" Version="1.0.7.2" /> | ||
<PackageReference Include="Microsoft.Packaging.Tools.Trimming" Version="1.1.0-preview1-26619-01" /> | ||
<PackageReference Include="SixLabors.ImageSharp" Version="1.0.0-beta0007" /> | ||
<PackageReference Include="SixLabors.ImageSharp.Drawing" Version="1.0.0-beta0007" /> | ||
</ItemGroup> | ||
|
||
</Project> |