public static void Render(FMAT material) { var renderer = material.MaterialAsset as SharcFBRenderer; if (renderer.GLShaderInfo == null) { return; } if (ImGui.BeginCombo("Stage", selectedStage)) { if (ImGui.Selectable("Vertex")) { selectedStage = "Vertex"; } if (ImGui.Selectable("Pixel")) { selectedStage = "Pixel"; } ImGui.EndCombo(); } ImGui.BeginTabBar("menu_shader1"); if (ImguiCustomWidgets.BeginTab("menu_shader1", $"Shader Code")) { LoadShaderStageCode(material); ImGui.EndTabItem(); } if (ImguiCustomWidgets.BeginTab("menu_shader1", "Shader Info")) { if (ImGui.BeginChild("ShaderInfoC")) { LoadShaderInfo(material); } ImGui.EndChild(); ImGui.EndTabItem(); } if (ImguiCustomWidgets.BeginTab("menu_shader1", "GX2 Shader Data")) { var shader = material.MaterialAsset as SharcFBRenderer; var program = shader.ShaderModel; if (selectedStage == "Vertex") { var gx2Shader = program.GetRawVertexShader(shader.BinaryIndex).ToArray(); MemoryEditor.Draw(gx2Shader, gx2Shader.Length); } if (selectedStage == "Pixel") { var gx2Shader = program.GetRawPixelShader(shader.BinaryIndex).ToArray(); MemoryEditor.Draw(gx2Shader, gx2Shader.Length); } ImGui.EndTabItem(); } }
public void LoadEditor(BfresBone bone) { ImGui.BeginTabBar("bone_tab"); if (ImguiCustomWidgets.BeginTab("bone_tab", "Bone Data")) { LoadBoneTab(bone); ImGui.EndTabItem(); } if (ImguiCustomWidgets.BeginTab("bone_tab", "User Data")) { UserDataInfoEditor.Render(bone.BoneData.UserData); ImGui.EndTabItem(); } ImGui.EndTabBar(); }
public void Render(GLFrameworkEngine.GLContext context) { if (ImGui.Begin("Lighting Editor", ref opened)) { ImGui.BeginTabBar("Menu1"); if (ImguiCustomWidgets.BeginTab("Menu1", "Color Correction")) { ImGui.EndTabItem(); } if (ImguiCustomWidgets.BeginTab("Menu1", "Environment")) { ImGui.EndTabItem(); } if (ImguiCustomWidgets.BeginTab("Menu1", "Light Maps")) { LightMapEditor.Render(context); ImGui.EndTabItem(); } if (ImguiCustomWidgets.BeginTab("Menu1", "Cube Maps")) { CubemapUintWindow.Render(context); ImGui.EndTabItem(); } ImGui.EndTabBar(); /* * ImGui.Columns(2); * if (ImGui.Selectable("Color Correction", ColorCorrectionWindow.IsActive)) { * ColorCorrectionWindow.IsActive = true; * } * ImGui.NextColumn(); * * if (ColorCorrectionWindow.IsActive) * ColorCorrectionWindow.Render(context); * * ImGui.NextColumn();*/ } ImGui.End(); }
public void Render(GX2VertexShader vertexShader, GX2PixelShader pixelShader) { if (string.IsNullOrEmpty(VertexShaderSource)) { OnLoad(vertexShader, pixelShader); } if (ImGui.BeginCombo("Stage", selectedStage)) { if (ImGui.Selectable("Vertex")) { selectedStage = "Vertex"; } if (ImGui.Selectable("Pixel")) { selectedStage = "Pixel"; } ImGui.EndCombo(); } ImGui.BeginTabBar("menu_shader1"); if (ImguiCustomWidgets.BeginTab("menu_shader1", $"Shader Code")) { LoadShaderStageCode(); ImGui.EndTabItem(); } if (ImguiCustomWidgets.BeginTab("menu_shader1", "Shader Info")) { if (ImGui.BeginChild("ShaderInfoC")) { LoadShaderInfo(vertexShader, pixelShader); } ImGui.EndChild(); ImGui.EndTabItem(); } }
private void LoadFileMenu() { float framerate = ImGui.GetIO().Framerate; if (ImGui.BeginMainMenuBar()) { if (ImGui.BeginMenu("File")) { if (ImGui.MenuItem("Open", "Ctrl+O", false, initGlobalShaders)) { OpenFileWithDialog(); } if (ImGui.BeginMenu("Recent")) { for (int i = 0; i < recentFiles.Count; i++) { if (ImGui.Selectable(recentFiles[i])) { LoadFileFormat(recentFiles[i]); } } ImGui.EndMenu(); } var canSave = Outliner.ActiveFileFormat != null && Outliner.ActiveFileFormat.CanSave; if (ImGui.MenuItem("Save", "Ctrl+S", false, canSave)) { SaveFileWithCurrentPath(); } if (ImGui.MenuItem("Save As", "Ctrl+Shift+S", false, canSave)) { SaveFileWithDialog(); } if (ImGui.MenuItem("Clear Workspace")) { ClearWorkspace(); } ImGui.EndMenu(); } if (ImGui.BeginMenu("Setting")) { ImGui.InputFloat("Font Size", ref font_scale, 0.1f); _config.RenderUI(); ImGui.EndMenu(); } if (ImGui.MenuItem("Style Editor")) { showStyleEditor = true; } if (_config.HasValidSMOPath) { if (ImGui.MenuItem("Mario Viewer", initGlobalShaders)) { TryLoadPartInfo(); } } /* if (ImGui.MenuItem("Lighting")) * { * showLightingEditor = true; * }*/ if (ImGui.MenuItem("Batch Render")) { showBatchWindow = true; } if (ImGui.BeginMenu("Help")) { if (ImGui.Selectable($"About")) { showAboutPage = true; } if (ImGui.Selectable($"Donate")) { BrowserHelper.OpenDonation(); } ImGui.EndMenu(); } float size = ImGui.GetWindowWidth(); if (!string.IsNullOrEmpty(status)) { string statusLabel = $"Status: {status}"; float lbSize = ImGui.CalcTextSize(statusLabel).X; ImGui.SetCursorPosX((size - (lbSize)) / 2); ImGui.Text($"Status: {status}"); } ImGui.SetCursorPosX(size - 100); ImGui.Text($"({framerate:0.#} FPS)"); ImGui.EndMainMenuBar(); } if (showBatchWindow) { if (ImGui.Begin("Batch Window", ref showBatchWindow)) { ImguiCustomWidgets.PathSelector("Input Folder", ref BatchRenderingTool.InputFolder); ImguiCustomWidgets.PathSelector("Output Folder", ref BatchRenderingTool.OutputFolder); ImGui.Checkbox("Odyssey Actor", ref BatchRenderingTool.OdysseyActor); ImGui.InputInt("Image Width", ref BatchRenderingTool.ImageWidth); ImGui.InputInt("Image Height", ref BatchRenderingTool.ImageHeight); if (BatchRenderingTool.IsOperationActive) { float progress = (float)BatchRenderingTool.ProcessAmount / BatchRenderingTool.ProcessTotal; ImGui.ProgressBar(progress, new System.Numerics.Vector2(300, 20)); ImGui.Text($"{BatchRenderingTool.ProcessName}"); if (ImGui.Button("Cancel Render")) { BatchRenderingTool.CancelOperation = true; } } if (Directory.Exists(BatchRenderingTool.InputFolder) && Directory.Exists(BatchRenderingTool.OutputFolder) && !BatchRenderingTool.IsOperationActive) { if (ImGui.Button("Start Render")) { string path = BatchRenderingTool.InputFolder; string output = BatchRenderingTool.OutputFolder; int width = BatchRenderingTool.ImageWidth; int height = BatchRenderingTool.ImageHeight; var Thread3 = new Thread((ThreadStart)(() => { BatchRenderingTool batchTool = new BatchRenderingTool(); batchTool.StartRender(path, output, width, height); })); Thread3.Start(); } } ImGui.End(); } } if (ProbeDebugger.DEBUG_MODE) { ProbeDebugger.DrawWindow(); } if (showStyleEditor) { if (ImGui.Begin("Style Editor", ref showStyleEditor)) { ImGui.ShowStyleEditor(); ImGui.End(); } } if (showLightingEditor) { if (lightingEditor == null) { lightingEditor = new BfresEditor.LightingEditor(); } lightingEditor.Render(this.Pipeline._context); } if (showAboutPage) { if (ImGui.Begin($"About", ref showAboutPage)) { if (ImGui.CollapsingHeader($"Credits", ImGuiTreeNodeFlags.DefaultOpen)) { ImGui.BulletText("KillzXGaming - main developer"); ImGui.BulletText("JuPaHe64 - created animation timeline"); ImGui.BulletText("Ryujinx - for shader libraries used to decompile and translate switch binaries into glsl code."); ImGui.BulletText("OpenTK Team - for opengl c# bindings."); ImGui.BulletText("mellinoe and IMGUI Team - for c# port and creating the IMGUI library"); ImGui.BulletText("Syroot - for bfres library and binary IO"); } ImGui.End(); } } }
public void LoadEditorMenus(FMAT material) { if (UVViewport == null) { Init(); } if (activeMaterial != material) { onLoad = true; MaterialParameter.Reset(); MaterialOptions.Reset(); BfresTextureMapEditor.Reset(); UVViewport.Reset(); } activeMaterial = material; if (ImGui.CollapsingHeader("Material Info", ImGuiTreeNodeFlags.DefaultOpen)) { ImGuiHelper.InputFromText("Name", material, "Name", 200); ImGuiHelper.InputFromText("ShaderArchive", material, "ShaderArchive", 200); ImGuiHelper.InputFromText("ShaderModel", material, "ShaderModel", 200); ImGuiHelper.InputFromBoolean("Visible", material.Material, "Visible"); } if (ImGui.BeginChild("##MATERIAL_EDITOR")) { ImGui.BeginTabBar("Menu1"); if (ImguiCustomWidgets.BeginTab("Menu1", "Texture Maps")) { BfresTextureMapEditor.Render(material, UVViewport, onLoad); ImGui.EndTabItem(); } if (ImguiCustomWidgets.BeginTab("Menu1", "Parameters")) { MaterialParameter.Render(material); ImGui.EndTabItem(); } if (ImguiCustomWidgets.BeginTab("Menu1", "Render Info")) { RenderInfoEditor.Render(material); ImGui.EndTabItem(); } if (ImguiCustomWidgets.BeginTab("Menu1", "Options")) { MaterialOptions.Render(material); ImGui.EndTabItem(); } if (!material.ParentFile.ResFile.IsPlatformSwitch) { if (ImguiCustomWidgets.BeginTab("Menu1", "Render State")) { RenderStateEditor.Render(material); ImGui.EndTabItem(); } } if (ImguiCustomWidgets.BeginTab("Menu1", "User Data")) { UserDataInfoEditor.Render(material.Material.UserData); ImGui.EndTabItem(); } if (material.MaterialAsset is BfshaRenderer) { if (ImguiCustomWidgets.BeginTab("Menu1", "Shader Data")) { BfshaShaderProgramViewer.Render(material); ImGui.EndTabItem(); } } else if (material.MaterialAsset is SharcFBRenderer) { if (ImguiCustomWidgets.BeginTab("Menu1", "Shader Data")) { SharcFBShaderProgramViewer.Render(material); ImGui.EndTabItem(); } } if (material.MaterialAsset is KSANXRender) { if (ImguiCustomWidgets.BeginTab("Menu1", "Lighting Data")) { ((KSANXRender)material.MaterialAsset).RenderUI(); ImGui.EndTabItem(); } } ImGui.EndTabBar(); } ImGui.EndChild(); onLoad = false; }
static void LoadBoneTab(BfresBone bone) { var boneData = bone.BoneData; if (ImGui.CollapsingHeader("Bone Info", ImGuiTreeNodeFlags.DefaultOpen)) { ImGuiHelper.InputFromBoolean("Visible", bone, "Visible"); ImGuiHelper.InputFromText("Name", bone, "Name", 200); int index = bone.Index; ImGui.SameLine(); ImGui.InputInt("Index", ref index); var parent = bone.Parent as BfresBone; if (parent != null) { var parentIndex = parent.Index; ImGuiHelper.InputFromText("Parent", parent, "Name", 200, ImGuiInputTextFlags.ReadOnly); ImGui.SameLine(); ImGui.InputInt("Index", ref parentIndex); } } if (ImGui.CollapsingHeader("Bone Transform", ImGuiTreeNodeFlags.DefaultOpen)) { var transform = ImguiCustomWidgets.Transform(bone.Position, bone.EulerRotation, bone.Scale); if (transform.Edited) { bone.Position = new OpenTK.Vector3( transform.Position.X, transform.Position.Y, transform.Position.Z); bone.Scale = new OpenTK.Vector3( transform.Scale.X, transform.Scale.Y, transform.Scale.Z); bone.EulerRotation = new OpenTK.Vector3( transform.Rotation.X, transform.Rotation.Y, transform.Rotation.Z); bone.UpdateBfresTransform(); bone.UpdateTransform(); } } if (ImGui.CollapsingHeader("Billboard", ImGuiTreeNodeFlags.DefaultOpen)) { ImGuiHelper.ComboFromEnum <BoneFlagsBillboard>("Type", boneData, "FlagsBillboard"); ImGuiHelper.InputFromShort("Index", boneData, "BillboardIndex"); } if (ImGui.CollapsingHeader("Matrix Indices", ImGuiTreeNodeFlags.DefaultOpen)) { int smoothIndex = boneData.SmoothMatrixIndex; int rigidIndex = boneData.RigidMatrixIndex; ImGui.InputInt("Smooth Index", ref smoothIndex); ImGui.InputInt("Rigid Index", ref rigidIndex); } if (ImGui.CollapsingHeader("Transform Modes", ImGuiTreeNodeFlags.DefaultOpen)) { ImGui.Columns(2); ImGuiHelper.InputFromBoolean("Identity", boneData, "TransformIdentity"); ImGui.NextColumn(); ImGui.NextColumn(); ImGuiHelper.InputFromBoolean("Rotate Translate Zero", boneData, "TransformRotateTranslateZero"); ImGui.NextColumn(); ImGuiHelper.InputFromBoolean("Scale One", boneData, "TransformScaleOne"); ImGui.NextColumn(); ImGuiHelper.InputFromBoolean("Rotate Zero", boneData, "TransformRotateZero"); ImGui.NextColumn(); ImGuiHelper.InputFromBoolean("Scale Uniform", boneData, "TransformScaleUniform"); ImGui.NextColumn(); ImGuiHelper.InputFromBoolean("Translate Zero", boneData, "TransformTranslateZero"); ImGui.NextColumn(); ImGuiHelper.InputFromBoolean("Scale Volume One", boneData, "TransformScaleVolumeOne"); ImGui.NextColumn(); ImGui.Columns(1); } if (ImGui.CollapsingHeader("Hierarchy Transform Modes", ImGuiTreeNodeFlags.DefaultOpen)) { ImGui.Columns(2); ImGuiHelper.InputFromBoolean("Identity", boneData, "TransformCumulativeIdentity"); ImGui.NextColumn(); ImGui.NextColumn(); ImGuiHelper.InputFromBoolean("Rotate Translate Zero", boneData, "TransformCumulativeRotateTranslateZero"); ImGui.NextColumn(); ImGuiHelper.InputFromBoolean("Scale One", boneData, "TransformCumulativeScaleOne"); ImGui.NextColumn(); ImGuiHelper.InputFromBoolean("Rotate Zero", boneData, "TransformCumulativeRotateZero"); ImGui.NextColumn(); ImGuiHelper.InputFromBoolean("Scale Uniform", boneData, "TransformCumulativeScaleUniform"); ImGui.NextColumn(); ImGuiHelper.InputFromBoolean("Translate Zero", boneData, "TransformCumulativeTranslateZero"); ImGui.NextColumn(); ImGuiHelper.InputFromBoolean("Scale Volume One", boneData, "TransformCumulativeScaleVolumeOne"); ImGui.NextColumn(); ImGui.Columns(1); } }
public static void Render(FMAT material) { var renderer = material.MaterialAsset as BfshaRenderer; if (ImGui.BeginCombo("Stage", selectedStage)) { if (ImGui.Selectable("Vertex")) { selectedStage = "Vertex"; } if (ImGui.Selectable("Pixel")) { selectedStage = "Pixel"; } ImGui.EndCombo(); } ImGui.BeginTabBar("menu_shader1"); if (ImguiCustomWidgets.BeginTab("menu_shader1", $"Shader Code")) { if (renderer.GLShaderInfo != null) { LoadShaderStageCode(material); } ImGui.EndTabItem(); } if (ImguiCustomWidgets.BeginTab("menu_shader1", "Shader Info")) { if (ImGui.BeginChild("ShaderInfoC")) { LoadShaderInfo(material); } ImGui.EndChild(); ImGui.EndTabItem(); } if (renderer.GLShaderInfo != null) { if (ImguiCustomWidgets.BeginTab("menu_shader1", "Shader Constants")) { if (selectedStage == "Vertex") { var constants = renderer.GLShaderInfo.VertexConstants; if (constants != null) { MemoryEditor.Draw(constants, constants.Length); } } if (selectedStage == "Pixel") { var constants = renderer.GLShaderInfo.PixelConstants; if (constants != null) { MemoryEditor.Draw(constants, constants.Length); } } ImGui.EndTabItem(); } } ImGui.EndTabBar(); }