1
0
mirror of synced 2024-11-12 02:00:50 +01:00
Switch-Toolbox/Switch_Toolbox_Library/Runtime.cs

248 lines
7.8 KiB
C#
Raw Normal View History

Add files for the new one. Rework UI from scratch with proper themes and custom controls. MDI windows are now used for workspaces, comparing docs, and multiple usages. Tabs organise multiple workspaces and you can keep mdi windows maximized if you want to only use tabs. Themes currently include dark and white theme but plan to have XML files with list of color and styles Alot of things optimized. UI is very fast and snappy now Dae rigging fixed. Dae bones can be imported. Dae with textures can be imported and exported to a folder Custom sampler editor for sampler data. Texture refs, shader options, params, render info, and basically all material data can be added/removed and edited User data editor Update opengl framework by JuPaHe64 to the newest. Includes an origintation cube, multiple models in a scene, and many improvements Skeleton can be viewed GFPAK with some fixes in saving NUTEXB has proper mip map viewing PTCL Editor (Wii U and Switch). Can edit colors ( Wii U) and view textures. Also EFFN files in smash ultimate can be previewed Files can be associated with the program and opened with on clicking them ASTC textures can be viewed UVs can be viewed. Includes wrap modes and also translating and scaling for some basic edits Textures use a new editor. It includes channel viewing and some new editing options Fixed black textures on some wii u bfres Fixed saving sarcs in sarcs Shortcut keys have been added in. CTRL + S can save the active file in the currently used window Fix more issues with bfres crashing File - New includes BNTX for creating new bntx files from scatch Raw shader binaries can be extracted from bnsh and bfsha. Yuzu and Ryujinx can decompile these Sharc files can have source data previewed and shader programs in XML Aamp v1 and v2 data can be previewed. v1 can be edited and saved atm, v2 will be at a later update Byaml uses it's own editor instead of a seperate window for easy saving within sarcs Archives have a hex viewer Dae exporting greatly improved and can export rigged meshes Scene, shader param, srt, color, and texture pattern animations can all be previewed (in a list) Memory usage is greatly improved Narc (Nitro Archives) can be viewed and extracted. Fixed importing TGA images Support importing ASTC textures for bntx Added in PBR lighting for bfres from my implimentaion in forge Added gradient background for viewport. This can be edited in the settings Added skybox background option for viewport. Can load cubemaps Added grid with customizable cells for viewport. DDS decompression no longer requires Direct X tex. Zlib decompression has been improved for opening files that use it Rigid bones are properly ordered on importing a mesh. May fix some exploding issues. Endianness for KCL can be toggled for saving. Will be set to what it was using orignally Tangents can be filled with a constant value. Will allow them to not cause seams nor flat lighting however normal maps may not work as good Vertex buffers can be added and removed. Also re encoded Parameters now use drop down panels with values for easier editing Reworked the bone editor. Everything for a bone can be fully edited now besides the index, billboard index and parent index which get set automatically Fixed animation scaling for skeletal animations finally! Textures can be loaded in a tab now with thumbnail displaying for easy real time edits while previewing in the viewport Fixed support for audio files to be big endian in BARS Textures for switch now use their own folder. You can easily add textures to this and add textures to bfres that have no bntx. If there are no textures then the bfres will automatically not have one on save. Animations are split into multiple sub sections for switch's material animation for easier access Bfres for wii u has better binary exporting and is fully compatiable with Wexos Toolbox (to and from) Every section can be added in as new for both wii u and switch. Every section can be renamed properly and mostly everything can be edited. (Key frame editing and a more in depth curve editor later) Added option to copy UV channel Bone weights can be previewed Tons of fixes for the switch bfres library with more games working. Splatoon 2 (more work now), BOTW, Kirby Star Allies, and more! Fixed 3.3 Wii U bfres from not opening Wii U Sharcfb files can have shader program data previewed (XML) And possibly alot more things i missed! All this is still experimental but will improve over the next few weeks
2019-03-23 17:55:09 +01:00
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Drawing;
using GL_EditorFramework.Interfaces;
using GL_EditorFramework.EditorDrawables;
using System.Windows.Forms;
namespace Switch_Toolbox.Library
{
//Thanks to Smash Forge for a few of these!
// https://github.com/jam1garner/Smash-Forge/blob/master/Smash%20Forge/Runtime.cs
public class Runtime
{
public class ImageEditor
{
public static bool ShowPropertiesPanel = true;
}
public class ObjectEditor
{
public static Point Location = new Point(364, 0);
public static int ListPanelWidth;
}
//Used for experimental edits
public static bool useEditDebugMode = false;
public static bool UseEditDebugMode
{
get
{
if (useEditDebugMode == false)
{
var result = MessageBox.Show("This feature is experimental and could lead to potential crashes. Are you sure you want to continue?",
"", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2, MessageBoxOptions.DefaultDesktopOnly);
if (result == DialogResult.Yes)
useEditDebugMode = true;
}
return useEditDebugMode;
}
}
public static int SelectedBoneIndex = -1;
//These are so we can load multiple drawables in the viewport
//Each viewport can carry it's own set of drawables
//When a viewport is made it will add a ViewportEditor instance and add drawables
//These will be switchable in settings to load specic objects in the scene or display all of them at once
public static List<ViewportEditor> viewportEditors = new List<ViewportEditor>();
public class ViewportEditor
{
public List<EditableObject> editableDrawables = new List<EditableObject>();
public List<AbstractGlDrawable> staticDrawables = new List<AbstractGlDrawable>();
public static int Width = 638;
}
public static TEX_FORMAT PreferredTexFormat = TEX_FORMAT.BC1_UNORM_SRGB;
public static string ExecutableDir;
public static Form MainForm;
public static bool UseDebugDomainExceptionHandler;
public static bool DisableUpdatePrompt;
public static bool MaximizeMdiWindow = false;
public static GridSettings gridSettings = new GridSettings();
public class GridSettings
{
public float CellSize = 1.0f;
public uint CellAmount = 10;
public Color color = Color.FromArgb(90, 90, 90);
}
public static float MaxCameraSpeed = 0.1f;
public static int Yaz0CompressionLevel = 3;
public static bool RenderModels = true;
public static bool RenderModelSelection = true;
public static bool RenderModelWireframe = false;
public static ViewportShading viewportShading;
public static bool IsDebugMode = true; //Enables experimental features and other things to debug.
public static bool DisableViewport = false;
public static bool EnablePBR = true;
public static bool enableVSync = false;
public static float floorSize = 30f;
public static Color floorColor = Color.Gray;
public static FloorStyle floorStyle = FloorStyle.WireFrame;
public static PictureBoxBG pictureBoxStyle = PictureBoxBG.Checkerboard;
public static float previewScale = 1.0f;
public static bool renderFloorLines = true;
//Viewport Background
public static BackgroundStyle backgroundStyle = BackgroundStyle.Gradient;
public static bool renderBackGround = true;
public static string backgroundTexFilePath = "";
public static Color backgroundGradientTop = Color.FromArgb(255, 26, 26, 26);
public static Color backgroundGradientBottom = Color.FromArgb(255, 77, 77, 77);
public static float zoomspeed = 1.25f;
public static float zoomModifierScale = 2.0f;
public static bool cameraLight = false;
public static bool DisplayPolyCount = true;
public static float PolyCount = 0;
public static float VertCount = 0;
public static bool enableOpenTKDebugOutput = false;
public static bool OpenStartupWindow = false;
// Toggle Render Passes
public static bool renderDiffuse = true;
public static bool renderFresnel = true;
public static bool renderSpecular = true;
public static bool renderReflection = true;
public static bool renderBoundingBoxes = true;
public static bool renderNormalMap = true;
public static bool renderVertColor = true;
public static bool renderBfresPbr = false;
public static bool renderNormalsPoints = false;
public static bool renderBones = true;
public static bool renderFog = true;
public static float bonePointSize = 0.2f;
public static bool boneXrayDisplay = false;
public static float normalsLineLength = 1;
public static bool stereoscopy = false;
public static bool UseLegacyGL = false;
public static bool OpenTKInitialized = false;
public static bool useNormalMap = true;
public static CameraMovement cameraMovement;
public static CameraView cameraView;
public static ThumbnailSize thumbnailSize = ThumbnailSize.Small;
public static float CameraNear = 0.1f;
public static float CameraFar = 100000.0f;
public static ActiveGame activeGame = ActiveGame.SMO;
public static string ProgramVersion = "0.0.0";
public static string CompileDate = "0/0/0000";
public static string CommitInfo = "";
public enum ActiveGame
{
SMO,
MK8D,
ARMs,
Splatoon2,
BOTW,
KSA,
}
public enum PictureBoxBG
{
Checkerboard,
Black,
White,
}
public enum CameraMovement
{
Inspect,
Walk,
}
public enum CameraView
{
Perspective,
Orthographic,
}
public enum ThumbnailSize
{
Small,
Medium,
Large
}
public enum BackgroundStyle
{
Gradient = 0,
UserTexture = 1,
Solid = 2,
}
public enum FloorStyle
{
WireFrame = 0,
UserTexture = 1,
Solid = 2,
}
public enum ViewportShading
{
Default = 0,
Normal = 1,
Lighting = 2,
Diffuse = 3,
NormalMap = 4,
VertColor = 5,
AmbientOcclusion = 6,
UVCoords = 7,
UVTestPattern = 8,
Tangents = 9,
Bitangents = 10,
LightMap = 11,
SelectedBoneWeights = 12,
SpecularMap = 13,
ShadowMap = 14,
MetalnessMap = 15,
RoughnessMap = 16,
SubSurfaceScatteringMap = 17,
EmmissionMap = 18,
}
public enum UVChannel
{
Channel1 = 1,
Channel2 = 2,
Channel3 = 3
}
// Debug Shading
public static bool renderR = true;
public static bool renderG = true;
public static bool renderB = true;
public static bool renderAlpha = true;
public static UVChannel uvChannel = UVChannel.Channel1;
// OpenGL System Information
public static string renderer = "";
public static string openGLVersion = "";
public static string GLSLVersion = "";
}
}