diff --git a/File_Format_Library/GL/KCL_Render.cs b/File_Format_Library/GL/KCL_Render.cs index 5ed40b34..475f5fc3 100644 --- a/File_Format_Library/GL/KCL_Render.cs +++ b/File_Format_Library/GL/KCL_Render.cs @@ -140,6 +140,8 @@ namespace FirstPlugin } } + public GLShaderGeneric Shader; + public ShaderProgram defaultShaderProgram; public ShaderProgram solidColorShaderProgram; @@ -181,6 +183,12 @@ namespace FirstPlugin gl_Position = mtxMdl * mtxCam * vec4(vPosition.xyz, 1.0); }"); + Shader = new GLShaderGeneric() + { + FragmentShader = File.ReadAllText(pathFrag), + VertexShader = File.ReadAllText(pathVert), + }; + defaultShaderProgram = new ShaderProgram(defaultFrag, defaultVert, control); solidColorShaderProgram = new ShaderProgram(solidColorFrag, solidColorVert, control); diff --git a/Switch_Toolbox_Library/Compression/Formats/Yay0.cs b/Switch_Toolbox_Library/Compression/Formats/Yay0.cs index 79a5b030..d61ad26a 100644 --- a/Switch_Toolbox_Library/Compression/Formats/Yay0.cs +++ b/Switch_Toolbox_Library/Compression/Formats/Yay0.cs @@ -42,6 +42,10 @@ namespace Toolbox.Library uint compressedOffset = reader.ReadUInt32(); uint uncompressedOffset = reader.ReadUInt32(); + while (output.Count < decompressedSize) + { + + } } return output.ToArray(); diff --git a/Switch_Toolbox_Library/FileFormats/Assimp/AssimpSaver.cs b/Switch_Toolbox_Library/FileFormats/Assimp/AssimpSaver.cs index 433371ae..34421caf 100644 --- a/Switch_Toolbox_Library/FileFormats/Assimp/AssimpSaver.cs +++ b/Switch_Toolbox_Library/FileFormats/Assimp/AssimpSaver.cs @@ -73,7 +73,9 @@ namespace Toolbox.Library bool ExportSuccessScene = v.ExportFile(scene, FileName, formatID, PostProcessSteps.FlipUVs); if (ExportSuccessScene) { - WriteExtraSkinningInfo(FileName, scene, Meshes); + if (ext == ".dae") + WriteExtraSkinningInfo(FileName, scene, Meshes); + MessageBox.Show($"Exported {FileName} Successfuly!"); } else diff --git a/Switch_Toolbox_Library/FileFormats/DAE/DAE.cs b/Switch_Toolbox_Library/FileFormats/DAE/DAE.cs index d886be24..7311887b 100644 --- a/Switch_Toolbox_Library/FileFormats/DAE/DAE.cs +++ b/Switch_Toolbox_Library/FileFormats/DAE/DAE.cs @@ -16,6 +16,27 @@ namespace Toolbox.Library { public class DAE : DAEHelper { + public class ExportSettings + { + public Version FileVersion = new Version(); + } + + public class Version + { + public int Major = 1; + public int Minor = 4; + public int Micro = 1; + } + + public static void Export(string fileName, ExportSettings exportSettings) + { + using (ColladaWriter writer = new ColladaWriter(fileName, exportSettings)) + { + + } + } + + public List objects = new List(); public List materials = new List(); public STSkeleton skeleton; diff --git a/Switch_Toolbox_Library/FileFormats/DAE/DAE_Writer.cs b/Switch_Toolbox_Library/FileFormats/DAE/DAE_Writer.cs new file mode 100644 index 00000000..ab737ca5 --- /dev/null +++ b/Switch_Toolbox_Library/FileFormats/DAE/DAE_Writer.cs @@ -0,0 +1,51 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Xml; + +namespace Toolbox.Library +{ + public class ColladaWriter : IDisposable + { + private XmlTextWriter Writer; + private DAE.ExportSettings Settings; + private DAE.Version Version; + + public ColladaWriter(string fileName, DAE.ExportSettings settings) + { + Settings = settings; + Version = settings.FileVersion; + Writer = new XmlTextWriter(fileName, Encoding.UTF8) + { + Formatting = Formatting.Indented, + Indentation = 2, + }; + } + + public void WriteHeader() + { + Writer.WriteStartDocument(); + Writer.WriteStartElement("COLLADA"); + Writer.WriteAttributeString("xmlns", "http://www.collada.org/2005/11/COLLADASchema"); + Writer.WriteAttributeString("version", $"{Version.Major}.{Version.Minor}.{Version.Micro}"); + } + + public void WriteAsset() + { + Writer.WriteStartElement("asset"); + Writer.WriteEndElement(); + } + + public static void WriteSectionAsset() + { + + } + + public void Dispose() + { + Writer.Close(); + } + } +} diff --git a/Switch_Toolbox_Library/Forms/Custom/Treeview/TreeViewCustom.cs b/Switch_Toolbox_Library/Forms/Custom/Treeview/TreeViewCustom.cs index 75db8afd..df7e511f 100644 --- a/Switch_Toolbox_Library/Forms/Custom/Treeview/TreeViewCustom.cs +++ b/Switch_Toolbox_Library/Forms/Custom/Treeview/TreeViewCustom.cs @@ -117,9 +117,15 @@ namespace Toolbox.Library { if (node is STGenericTexture) { - var image = ((STGenericTexture)node).GetBitmap(); - if (image != null) - AddImageOnThread(image, node); + try + { + var image = ((STGenericTexture)node).GetBitmap(); + if (image != null) + AddImageOnThread(image, node); + } + catch + { + } } } } @@ -129,9 +135,16 @@ namespace Toolbox.Library if (SingleTextureIcons[i] == null || SingleTextureIcons[i].IconTexture == null) continue; - var image = SingleTextureIcons[i].IconTexture.GetBitmap(); - if (image != null) - AddImageOnThread(image, SingleTextureIcons[i].IconTexture); + try + { + var image = SingleTextureIcons[i].IconTexture.GetBitmap(); + if (image != null) + AddImageOnThread(image, SingleTextureIcons[i].IconTexture); + } + catch + { + + } } })); Thread.Start(); diff --git a/Switch_Toolbox_Library/Forms/Editors/TextEditor/TextEditor.cs b/Switch_Toolbox_Library/Forms/Editors/TextEditor/TextEditor.cs index 79ac1ca5..1d87ef1f 100644 --- a/Switch_Toolbox_Library/Forms/Editors/TextEditor/TextEditor.cs +++ b/Switch_Toolbox_Library/Forms/Editors/TextEditor/TextEditor.cs @@ -12,8 +12,15 @@ using ScintillaNET_FindReplaceDialog; namespace Toolbox.Library.Forms { - public partial class TextEditor : UserControl + public partial class TextEditor : UserControl, IFIleEditor { + public IFileFormat FileFormat; + + public List GetFileFormats() + { + return new List() { FileFormat }; + } + FindReplace findReplaceDialog; private void ResetTypes() diff --git a/Switch_Toolbox_Library/Forms/Viewport.cs b/Switch_Toolbox_Library/Forms/Viewport.cs index 611fcfbd..dd41678a 100644 --- a/Switch_Toolbox_Library/Forms/Viewport.cs +++ b/Switch_Toolbox_Library/Forms/Viewport.cs @@ -248,11 +248,11 @@ namespace Toolbox.Library var skybox = new DrawableSkybox(); var background = new DrawableBackground(); - scene.staticObjects.Add(floor); + /* scene.staticObjects.Add(floor); scene.staticObjects.Add(xyzLnes); scene.staticObjects.Add(skybox); scene.staticObjects.Add(background); - + */ // scene.objects.Add(new SingleObject(new Vector3(0, 0, 0))); // LoadFog(); diff --git a/Switch_Toolbox_Library/Generics/GenericPolygonGroup.cs b/Switch_Toolbox_Library/Generics/GenericPolygonGroup.cs index 9b8b7024..8f9a7195 100644 --- a/Switch_Toolbox_Library/Generics/GenericPolygonGroup.cs +++ b/Switch_Toolbox_Library/Generics/GenericPolygonGroup.cs @@ -6,6 +6,16 @@ using System.Threading.Tasks; namespace Toolbox.Library { + public enum STPrimativeType + { + Points = 0, + Lines = 1, + LineStrips = 2, + Triangles = 3, + TrangleStrips, + Quads, + } + public class STGenericPolygonGroup { public int Offset { get; set; } @@ -14,6 +24,8 @@ namespace Toolbox.Library public List faces = new List(); + public STPrimativeType PrimativeType = STPrimativeType.Triangles; + public int strip = 0x40; public int displayFaceSize = 0; diff --git a/Switch_Toolbox_Library/OpenGL/ShaderManager.cs b/Switch_Toolbox_Library/OpenGL/ShaderManager.cs new file mode 100644 index 00000000..233196c0 --- /dev/null +++ b/Switch_Toolbox_Library/OpenGL/ShaderManager.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Toolbox.Library +{ + public class ShaderManager + { + + } +} diff --git a/Switch_Toolbox_Library/Properties/Resources.Designer.cs b/Switch_Toolbox_Library/Properties/Resources.Designer.cs index b3404655..a4f65e60 100644 --- a/Switch_Toolbox_Library/Properties/Resources.Designer.cs +++ b/Switch_Toolbox_Library/Properties/Resources.Designer.cs @@ -760,6 +760,16 @@ namespace Toolbox.Library.Properties { } } + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + public static System.Drawing.Bitmap MissingTexture { + get { + object obj = ResourceManager.GetObject("MissingTexture", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// diff --git a/Switch_Toolbox_Library/Properties/Resources.resx b/Switch_Toolbox_Library/Properties/Resources.resx index c3678b39..d31f22f9 100644 --- a/Switch_Toolbox_Library/Properties/Resources.resx +++ b/Switch_Toolbox_Library/Properties/Resources.resx @@ -415,4 +415,7 @@ ..\Resources\AnimationTrackZ.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\MissingTexture.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + \ No newline at end of file diff --git a/Switch_Toolbox_Library/Resources/MissingTexture.png b/Switch_Toolbox_Library/Resources/MissingTexture.png new file mode 100644 index 00000000..cb65ba9d Binary files /dev/null and b/Switch_Toolbox_Library/Resources/MissingTexture.png differ diff --git a/Switch_Toolbox_Library/Toolbox_Library.csproj b/Switch_Toolbox_Library/Toolbox_Library.csproj index 400f12eb..506cd01c 100644 --- a/Switch_Toolbox_Library/Toolbox_Library.csproj +++ b/Switch_Toolbox_Library/Toolbox_Library.csproj @@ -247,6 +247,7 @@ + @@ -399,6 +400,7 @@ + UserControl @@ -1389,6 +1391,7 @@ + @@ -1496,6 +1499,9 @@ + + +