mirror of
https://github.com/KillzXGaming/Switch-Toolbox
synced 2024-11-22 20:43:09 +00:00
More improvements.
Camera is now centerd when a bfres is selected. This will apply to reseting the camera aswell. The method is based on Smash Forge so thanks to the devs for it. Start on bfsha program linking for bfres materials. Dunno how far i'll take this. Basic ortho mode added. Needs improvements to zoom in and mainly just changes the projection matrix to ortho atm. Controls are not altered.
This commit is contained in:
parent
50586ef978
commit
6d7579e6e0
24 changed files with 293 additions and 91 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -421,6 +421,9 @@ namespace FirstPlugin
|
|||
|
||||
bool IsSimpleEditor = PluginRuntime.UseSimpleBfresEditor;
|
||||
|
||||
if (SelectedSection is BFRES)
|
||||
bfresEditor.FrameCamera(BFRESRender);
|
||||
|
||||
if (IsSimpleEditor)
|
||||
{
|
||||
if (SelectedSection is MatTextureWrapper)
|
||||
|
|
|
@ -578,13 +578,13 @@ namespace FirstPlugin
|
|||
}
|
||||
else
|
||||
{
|
||||
if (texture.SamplerName == "_a0")
|
||||
if (useSampler == "_a0")
|
||||
{
|
||||
m.HasDiffuseMap = true;
|
||||
AlbedoCount++;
|
||||
texture.Type = MatTexture.TextureType.Diffuse;
|
||||
}
|
||||
if (texture.SamplerName == "_n0")
|
||||
if (useSampler == "_n0")
|
||||
{
|
||||
m.HasNormalMap = true;
|
||||
texture.Type = MatTexture.TextureType.Normal;
|
||||
|
|
|
@ -8,6 +8,7 @@ using Switch_Toolbox.Library;
|
|||
using Switch_Toolbox.Library.IO;
|
||||
using BfshaLibrary;
|
||||
using System.Windows.Forms;
|
||||
using ResNX = Syroot.NintenTools.NSW.Bfres;
|
||||
|
||||
namespace FirstPlugin
|
||||
{
|
||||
|
@ -40,6 +41,8 @@ namespace FirstPlugin
|
|||
}
|
||||
}
|
||||
|
||||
BfshaFile bfshaFile;
|
||||
|
||||
public void Load(System.IO.Stream stream)
|
||||
{
|
||||
Text = FileName;
|
||||
|
@ -51,7 +54,7 @@ namespace FirstPlugin
|
|||
}
|
||||
else
|
||||
{
|
||||
BfshaFile bfshaFile = new BfshaFile(stream);
|
||||
bfshaFile = new BfshaFile(stream);
|
||||
|
||||
foreach (var model in bfshaFile.ShaderModels)
|
||||
{
|
||||
|
@ -61,6 +64,29 @@ namespace FirstPlugin
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int GetStaticKey(ResNX.ShaderAssign ShaderAssign)
|
||||
{
|
||||
if (bfshaFile.ShaderModelDict.ContainsKey(ShaderAssign.ShadingModelName))
|
||||
{
|
||||
int ModelIndex = bfshaFile.ShaderModelDict.IndexOf(ShaderAssign.ShadingModelName);
|
||||
|
||||
for (int option = 0; option < ShaderAssign.ShaderOptions.Count; option++)
|
||||
{
|
||||
int OptionIndex = bfshaFile.ShaderModels[ModelIndex].StaticOptionDict.IndexOf(ShaderAssign.ShaderOptions[option]);
|
||||
var OptionStatic = bfshaFile.ShaderModels[ModelIndex].StaticOptions[OptionIndex];
|
||||
|
||||
int ChoiceIndex = OptionStatic.ChoiceDict.IndexOf(ShaderAssign.ShaderOptions[option]);
|
||||
|
||||
return bfshaFile.ShaderModels[ModelIndex].GetStaticKey(OptionIndex, ChoiceIndex);
|
||||
}
|
||||
}
|
||||
else
|
||||
throw new Exception("Model not found in bfsha!");
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
public void Unload()
|
||||
{
|
||||
|
||||
|
|
|
@ -197,56 +197,19 @@ namespace FirstPlugin
|
|||
|
||||
}
|
||||
|
||||
public void FrameSelection(GL_ControlModern control)
|
||||
public void CenterCamera(GL_ControlModern control)
|
||||
{
|
||||
var spheres = new List<Vector4>();
|
||||
foreach (var model in models)
|
||||
foreach (var mdl in models)
|
||||
{
|
||||
foreach (var shape in model.shapes)
|
||||
foreach (FSHP shp in mdl.shapes)
|
||||
{
|
||||
List<Vector3> vertexPositions = new List<Vector3>();
|
||||
foreach (var vertex in shape.vertices)
|
||||
{
|
||||
vertexPositions.Add(vertex.pos);
|
||||
}
|
||||
spheres.Add(SFGraphics.Utils.BoundingSphereGenerator.GenerateBoundingSphere(vertexPositions));
|
||||
var vertexPositions = shp.vertices.Select(x => x.pos).Distinct();
|
||||
spheres.Add(control.GenerateBoundingSphere(vertexPositions));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//Depth sort meshes
|
||||
DepthSortMeshes(control.CameraTarget);
|
||||
}
|
||||
|
||||
public void CenterCamera(GL_ControlModern control)
|
||||
{
|
||||
Vector3 minVector = new Vector3(0);
|
||||
Vector3 maxVector = new Vector3(0);
|
||||
if (models.Count != 0)
|
||||
{
|
||||
minVector = models[0].MinPosition;
|
||||
maxVector = models[0].MaxPosition;
|
||||
}
|
||||
|
||||
Vector3 translation = control.CameraPosition;
|
||||
|
||||
float minSize = Math.Min(Math.Min(minVector.X, minVector.Y), minVector.Z);
|
||||
float maxSize = Math.Max(Math.Max(maxVector.X, maxVector.Y), maxVector.Z);
|
||||
float scale = (10f / (maxSize - minSize)); //Try to adjust to screen
|
||||
if (maxSize - minSize == 0) scale = 1;
|
||||
|
||||
Matrix4 centerMatrix = Matrix4.CreateTranslation(
|
||||
-(minVector.X + maxVector.X) / 2,
|
||||
-(minVector.Y + maxVector.Y) / 2,
|
||||
-(minVector.Z + maxVector.Z) / 2);
|
||||
Matrix4 translationMatrix = Matrix4.CreateTranslation(
|
||||
(-translation.X / 50) / scale,
|
||||
(translation.Y / 50) / scale,
|
||||
control.CameraDistance / scale);
|
||||
|
||||
|
||||
|
||||
control.CameraPosition = centerMatrix.ExtractTranslation();
|
||||
control.FrameSelect(spheres);
|
||||
}
|
||||
|
||||
public static Vector4 GenerateBoundingSphere(IEnumerable<Vector4> boundingSpheres)
|
||||
|
@ -302,8 +265,8 @@ namespace FirstPlugin
|
|||
|
||||
if (models.Count > 0)
|
||||
{
|
||||
if (models[0].Parent.Parent.IsSelected)
|
||||
CenterCamera(control);
|
||||
// if (models[0].Parent.Parent.IsSelected)
|
||||
// CenterCamera(control);
|
||||
|
||||
if (models[0].shapes.Count > 0)
|
||||
{
|
||||
|
|
|
@ -123,6 +123,18 @@ namespace FirstPlugin.Forms
|
|||
return null;
|
||||
}
|
||||
|
||||
public void FrameCamera(BFRESRender Renderer)
|
||||
{
|
||||
if (!Runtime.UseOpenGL || !DisplayViewport)
|
||||
return;
|
||||
|
||||
if (viewport.GL_ControlModern != null)
|
||||
{
|
||||
Renderer.CenterCamera(viewport.GL_ControlModern);
|
||||
viewport.UpdateViewport();
|
||||
}
|
||||
}
|
||||
|
||||
public void LoadEditor(UserControl Control)
|
||||
{
|
||||
Control.Dock = DockStyle.Fill;
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -211,6 +211,11 @@ namespace Switch_Toolbox.Library
|
|||
case "UseDiffuseSkyTexture":
|
||||
bool.TryParse(node.InnerText, out Runtime.PBR.UseDiffuseSkyTexture);
|
||||
break;
|
||||
case "ViewportCameraMode":
|
||||
Runtime.CameraMode cameraMode;
|
||||
Enum.TryParse(node.InnerText, out cameraMode);
|
||||
Runtime.ViewportCameraMode = cameraMode;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -385,6 +390,7 @@ namespace Switch_Toolbox.Library
|
|||
{
|
||||
XmlNode renderSettingsNode = doc.CreateElement("RENDERSETTINGS");
|
||||
parentNode.AppendChild(renderSettingsNode);
|
||||
renderSettingsNode.AppendChild(createNode(doc, "ViewportCameraMode", Runtime.ViewportCameraMode.ToString()));
|
||||
renderSettingsNode.AppendChild(createNode(doc, "viewportShading", Runtime.viewportShading.ToString()));
|
||||
renderSettingsNode.AppendChild(createNode(doc, "stereoscopy", Runtime.stereoscopy.ToString()));
|
||||
renderSettingsNode.AppendChild(createNode(doc, "CameraFar", Runtime.CameraFar.ToString()));
|
||||
|
|
|
@ -180,7 +180,7 @@ namespace Switch_Toolbox.Library.Forms
|
|||
UpdateBackgroundImage();
|
||||
SetZoomSetting();
|
||||
|
||||
SetEditorOrientation(Runtime.ImageEditor.DisplayVertical);
|
||||
SetEditorOrientation(Runtime.ImageEditor.DisplayVertical, true);
|
||||
|
||||
|
||||
propertyGridToolStripMenuItem.Checked = Runtime.ImageEditor.ShowPropertiesPanel;
|
||||
|
@ -208,10 +208,14 @@ namespace Switch_Toolbox.Library.Forms
|
|||
FileWatcher.Filter = "";
|
||||
}
|
||||
|
||||
public void SetEditorOrientation(bool ToVertical)
|
||||
public void SetEditorOrientation(bool ToVertical, bool IsStartup = false)
|
||||
{
|
||||
displayVerticalToolStripMenuItem.Checked = ToVertical;
|
||||
SetOrientation();
|
||||
//Check if it's already set the setting and is not from creating a new instance. It's not necessary to reset if it is.
|
||||
if (displayVerticalToolStripMenuItem.Checked != ToVertical || IsStartup)
|
||||
{
|
||||
displayVerticalToolStripMenuItem.Checked = ToVertical;
|
||||
SetOrientation();
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateBackgroundImage()
|
||||
|
|
141
Switch_Toolbox_Library/Forms/Viewport.Designer.cs
generated
141
Switch_Toolbox_Library/Forms/Viewport.Designer.cs
generated
|
@ -32,14 +32,22 @@
|
|||
this.panelViewport = new Switch_Toolbox.Library.Forms.STPanel();
|
||||
this.stContextMenuStrip1 = new Switch_Toolbox.Library.Forms.STMenuStrip();
|
||||
this.viewToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.vewportToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.modelToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.animationToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.cameraToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.modeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.perspectiveToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.orthographicToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.orientationToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.frontToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.backToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.topToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.bottomToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.rightToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.leftToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.shadingToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.resetCameraToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.resetPoseToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.optionsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.reloadShadersToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.resetPoseToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.stContextMenuStrip1.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
|
@ -78,30 +86,97 @@
|
|||
// viewToolStripMenuItem
|
||||
//
|
||||
this.viewToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.vewportToolStripMenuItem,
|
||||
this.modelToolStripMenuItem,
|
||||
this.animationToolStripMenuItem});
|
||||
this.cameraToolStripMenuItem});
|
||||
this.viewToolStripMenuItem.Name = "viewToolStripMenuItem";
|
||||
this.viewToolStripMenuItem.Size = new System.Drawing.Size(44, 20);
|
||||
this.viewToolStripMenuItem.Text = "View";
|
||||
//
|
||||
// vewportToolStripMenuItem
|
||||
// cameraToolStripMenuItem
|
||||
//
|
||||
this.vewportToolStripMenuItem.Name = "vewportToolStripMenuItem";
|
||||
this.vewportToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
|
||||
this.vewportToolStripMenuItem.Text = "Vewport";
|
||||
this.cameraToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.modeToolStripMenuItem,
|
||||
this.orientationToolStripMenuItem});
|
||||
this.cameraToolStripMenuItem.Name = "cameraToolStripMenuItem";
|
||||
this.cameraToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
|
||||
this.cameraToolStripMenuItem.Text = "Camera";
|
||||
//
|
||||
// modelToolStripMenuItem
|
||||
// modeToolStripMenuItem
|
||||
//
|
||||
this.modelToolStripMenuItem.Name = "modelToolStripMenuItem";
|
||||
this.modelToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
|
||||
this.modelToolStripMenuItem.Text = "Model";
|
||||
this.modeToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.perspectiveToolStripMenuItem,
|
||||
this.orthographicToolStripMenuItem});
|
||||
this.modeToolStripMenuItem.Name = "modeToolStripMenuItem";
|
||||
this.modeToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
|
||||
this.modeToolStripMenuItem.Text = "Mode";
|
||||
//
|
||||
// animationToolStripMenuItem
|
||||
// perspectiveToolStripMenuItem
|
||||
//
|
||||
this.animationToolStripMenuItem.Name = "animationToolStripMenuItem";
|
||||
this.animationToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
|
||||
this.animationToolStripMenuItem.Text = "Animation";
|
||||
this.perspectiveToolStripMenuItem.Name = "perspectiveToolStripMenuItem";
|
||||
this.perspectiveToolStripMenuItem.Size = new System.Drawing.Size(145, 22);
|
||||
this.perspectiveToolStripMenuItem.Text = "Perspective";
|
||||
this.perspectiveToolStripMenuItem.Click += new System.EventHandler(this.perspectiveToolStripMenuItem_Click);
|
||||
//
|
||||
// orthographicToolStripMenuItem
|
||||
//
|
||||
this.orthographicToolStripMenuItem.Name = "orthographicToolStripMenuItem";
|
||||
this.orthographicToolStripMenuItem.Size = new System.Drawing.Size(145, 22);
|
||||
this.orthographicToolStripMenuItem.Text = "Orthographic";
|
||||
this.orthographicToolStripMenuItem.Click += new System.EventHandler(this.orthographicToolStripMenuItem_Click);
|
||||
//
|
||||
// orientationToolStripMenuItem
|
||||
//
|
||||
this.orientationToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.frontToolStripMenuItem,
|
||||
this.backToolStripMenuItem,
|
||||
this.topToolStripMenuItem,
|
||||
this.bottomToolStripMenuItem,
|
||||
this.rightToolStripMenuItem,
|
||||
this.leftToolStripMenuItem});
|
||||
this.orientationToolStripMenuItem.Name = "orientationToolStripMenuItem";
|
||||
this.orientationToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
|
||||
this.orientationToolStripMenuItem.Text = "Orientation";
|
||||
//
|
||||
// frontToolStripMenuItem
|
||||
//
|
||||
this.frontToolStripMenuItem.Name = "frontToolStripMenuItem";
|
||||
this.frontToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
|
||||
this.frontToolStripMenuItem.Text = "Front";
|
||||
this.frontToolStripMenuItem.Click += new System.EventHandler(this.frontToolStripMenuItem_Click);
|
||||
//
|
||||
// backToolStripMenuItem
|
||||
//
|
||||
this.backToolStripMenuItem.Name = "backToolStripMenuItem";
|
||||
this.backToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
|
||||
this.backToolStripMenuItem.Text = "Back";
|
||||
this.backToolStripMenuItem.Click += new System.EventHandler(this.backToolStripMenuItem_Click);
|
||||
//
|
||||
// topToolStripMenuItem
|
||||
//
|
||||
this.topToolStripMenuItem.Name = "topToolStripMenuItem";
|
||||
this.topToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
|
||||
this.topToolStripMenuItem.Text = "Top";
|
||||
this.topToolStripMenuItem.Click += new System.EventHandler(this.topToolStripMenuItem_Click);
|
||||
//
|
||||
// bottomToolStripMenuItem
|
||||
//
|
||||
this.bottomToolStripMenuItem.Name = "bottomToolStripMenuItem";
|
||||
this.bottomToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
|
||||
this.bottomToolStripMenuItem.Text = "Bottom";
|
||||
this.bottomToolStripMenuItem.Click += new System.EventHandler(this.bottomToolStripMenuItem_Click);
|
||||
//
|
||||
// rightToolStripMenuItem
|
||||
//
|
||||
this.rightToolStripMenuItem.Name = "rightToolStripMenuItem";
|
||||
this.rightToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
|
||||
this.rightToolStripMenuItem.Text = "Right";
|
||||
this.rightToolStripMenuItem.Click += new System.EventHandler(this.rightToolStripMenuItem_Click);
|
||||
//
|
||||
// leftToolStripMenuItem
|
||||
//
|
||||
this.leftToolStripMenuItem.Name = "leftToolStripMenuItem";
|
||||
this.leftToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
|
||||
this.leftToolStripMenuItem.Text = "Left";
|
||||
this.leftToolStripMenuItem.Click += new System.EventHandler(this.leftToolStripMenuItem_Click);
|
||||
//
|
||||
// shadingToolStripMenuItem
|
||||
//
|
||||
|
@ -117,6 +192,13 @@
|
|||
this.resetCameraToolStripMenuItem.Text = "Reset Camera";
|
||||
this.resetCameraToolStripMenuItem.Click += new System.EventHandler(this.resetCameraToolStripMenuItem_Click);
|
||||
//
|
||||
// resetPoseToolStripMenuItem
|
||||
//
|
||||
this.resetPoseToolStripMenuItem.Name = "resetPoseToolStripMenuItem";
|
||||
this.resetPoseToolStripMenuItem.Size = new System.Drawing.Size(75, 20);
|
||||
this.resetPoseToolStripMenuItem.Text = "Reset Pose";
|
||||
this.resetPoseToolStripMenuItem.Click += new System.EventHandler(this.resetPoseToolStripMenuItem_Click);
|
||||
//
|
||||
// optionsToolStripMenuItem
|
||||
//
|
||||
this.optionsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
|
@ -132,13 +214,6 @@
|
|||
this.reloadShadersToolStripMenuItem.Text = "Reload Shaders";
|
||||
this.reloadShadersToolStripMenuItem.Click += new System.EventHandler(this.reloadShadersToolStripMenuItem_Click);
|
||||
//
|
||||
// resetPoseToolStripMenuItem
|
||||
//
|
||||
this.resetPoseToolStripMenuItem.Name = "resetPoseToolStripMenuItem";
|
||||
this.resetPoseToolStripMenuItem.Size = new System.Drawing.Size(75, 20);
|
||||
this.resetPoseToolStripMenuItem.Text = "Reset Pose";
|
||||
this.resetPoseToolStripMenuItem.Click += new System.EventHandler(this.resetPoseToolStripMenuItem_Click);
|
||||
//
|
||||
// Viewport
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
|
@ -160,13 +235,21 @@
|
|||
private Forms.STPanel panelViewport;
|
||||
private Forms.STMenuStrip stContextMenuStrip1;
|
||||
private System.Windows.Forms.ToolStripMenuItem viewToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem vewportToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem modelToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem animationToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem resetCameraToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem shadingToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem optionsToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem reloadShadersToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem resetPoseToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem cameraToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem modeToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem perspectiveToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem orthographicToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem orientationToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem frontToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem backToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem topToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem bottomToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem rightToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem leftToolStripMenuItem;
|
||||
}
|
||||
}
|
|
@ -35,6 +35,8 @@ namespace Switch_Toolbox.Library
|
|||
editor = new Runtime.ViewportEditor();
|
||||
Runtime.viewportEditors.Add(editor);
|
||||
|
||||
perspectiveToolStripMenuItem.Checked = Runtime.ViewportCameraMode == Runtime.CameraMode.Perspective;
|
||||
|
||||
foreach (var type in Enum.GetValues(typeof(Runtime.ViewportShading)).Cast<Runtime.ViewportShading>())
|
||||
{
|
||||
if (type == Runtime.viewportShading)
|
||||
|
@ -283,18 +285,12 @@ namespace Switch_Toolbox.Library
|
|||
{
|
||||
if (GL_ControlLegacy != null)
|
||||
{
|
||||
GL_ControlLegacy.CamRotX = 0;
|
||||
GL_ControlLegacy.CamRotY = 0;
|
||||
GL_ControlLegacy.CameraTarget = new OpenTK.Vector3(0);
|
||||
GL_ControlLegacy.CameraDistance = 10f;
|
||||
GL_ControlLegacy.ResetCamera();
|
||||
GL_ControlLegacy.Refresh();
|
||||
}
|
||||
else
|
||||
{
|
||||
GL_ControlModern.CamRotX = 0;
|
||||
GL_ControlModern.CamRotY = 0;
|
||||
GL_ControlModern.CameraTarget = new OpenTK.Vector3(0);
|
||||
GL_ControlModern.CameraDistance = 10f;
|
||||
GL_ControlModern.ResetCamera();
|
||||
GL_ControlModern.Refresh();
|
||||
}
|
||||
}
|
||||
|
@ -320,5 +316,97 @@ namespace Switch_Toolbox.Library
|
|||
animationPanel1.ResetModels();
|
||||
}
|
||||
}
|
||||
|
||||
private void perspectiveToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (perspectiveToolStripMenuItem.Checked)
|
||||
{
|
||||
perspectiveToolStripMenuItem.Checked = false;
|
||||
orthographicToolStripMenuItem.Checked = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
orthographicToolStripMenuItem.Checked = false;
|
||||
perspectiveToolStripMenuItem.Checked = true;
|
||||
}
|
||||
|
||||
bool IsOrtho = orthographicToolStripMenuItem.Checked;
|
||||
|
||||
if (GL_ControlModern != null)
|
||||
GL_ControlModern.UseOrthographicView = IsOrtho;
|
||||
else
|
||||
GL_ControlLegacy.UseOrthographicView = IsOrtho;
|
||||
|
||||
UpdateViewport();
|
||||
}
|
||||
|
||||
private void orthographicToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (orthographicToolStripMenuItem.Checked)
|
||||
{
|
||||
orthographicToolStripMenuItem.Checked = false;
|
||||
perspectiveToolStripMenuItem.Checked = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
perspectiveToolStripMenuItem.Checked = false;
|
||||
orthographicToolStripMenuItem.Checked = true;
|
||||
}
|
||||
|
||||
bool IsOrtho = orthographicToolStripMenuItem.Checked;
|
||||
|
||||
if (GL_ControlModern != null)
|
||||
GL_ControlModern.UseOrthographicView = IsOrtho;
|
||||
else
|
||||
GL_ControlLegacy.UseOrthographicView = IsOrtho;
|
||||
|
||||
UpdateViewport();
|
||||
}
|
||||
|
||||
private enum CameraPickBuffer
|
||||
{
|
||||
Top = 1,
|
||||
Bottom = 2,
|
||||
Front = 3,
|
||||
Back = 4,
|
||||
Left = 5,
|
||||
Right = 6,
|
||||
}
|
||||
|
||||
private void frontToolStripMenuItem_Click(object sender, EventArgs e) {
|
||||
ApplyCameraOrientation(CameraPickBuffer.Front);
|
||||
}
|
||||
|
||||
private void backToolStripMenuItem_Click(object sender, EventArgs e) {
|
||||
ApplyCameraOrientation(CameraPickBuffer.Back);
|
||||
}
|
||||
|
||||
private void topToolStripMenuItem_Click(object sender, EventArgs e) {
|
||||
ApplyCameraOrientation(CameraPickBuffer.Top);
|
||||
}
|
||||
|
||||
private void bottomToolStripMenuItem_Click(object sender, EventArgs e) {
|
||||
ApplyCameraOrientation(CameraPickBuffer.Bottom);
|
||||
}
|
||||
|
||||
private void rightToolStripMenuItem_Click(object sender, EventArgs e) {
|
||||
ApplyCameraOrientation(CameraPickBuffer.Right);
|
||||
}
|
||||
|
||||
private void leftToolStripMenuItem_Click(object sender, EventArgs e) {
|
||||
ApplyCameraOrientation(CameraPickBuffer.Left);
|
||||
}
|
||||
|
||||
private void ApplyCameraOrientation(CameraPickBuffer CameraPick)
|
||||
{
|
||||
int pickingBuffer = (int)CameraPick;
|
||||
|
||||
if (GL_ControlModern != null)
|
||||
GL_ControlModern.ApplyCameraOrientation(pickingBuffer);
|
||||
else
|
||||
GL_ControlModern.ApplyCameraOrientation(pickingBuffer);
|
||||
|
||||
UpdateViewport();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -108,6 +108,13 @@ namespace Switch_Toolbox.Library
|
|||
|
||||
public static float MaxCameraSpeed = 0.1f;
|
||||
|
||||
public static CameraMode ViewportCameraMode = CameraMode.Perspective;
|
||||
public enum CameraMode
|
||||
{
|
||||
Perspective,
|
||||
Orthographic,
|
||||
}
|
||||
|
||||
public static int Yaz0CompressionLevel = 3;
|
||||
public static bool RenderModels = true;
|
||||
public static bool RenderModelSelection = true;
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -938,6 +938,16 @@
|
|||
Returns the key given <paramref name="index"/> is within range of the dictionary.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:BfshaLibrary.ResDict.IndexOf(System.String)">
|
||||
<summary>
|
||||
Searches for the specified <paramref name="value"/> and returns the zero-based index of the first occurrence
|
||||
within the entire dictionary.
|
||||
</summary>
|
||||
<param name="value">The <see cref="T:BfshaLibrary.Core.IResData"/> instance to locate in the dictionary. The value can be
|
||||
<c>null</c>.</param>
|
||||
<returns>The zero-based index of the first occurence of <paramref name="value"/> within the entire
|
||||
dictionary if found; otherwise <c>-1</c>.</returns>
|
||||
</member>
|
||||
<member name="M:BfshaLibrary.ResDict.Clear">
|
||||
<summary>
|
||||
Removes all elements from the dictionary.
|
||||
|
|
|
@ -190,8 +190,8 @@ void main()
|
|||
//Usually it's just metalness with roughness and works fine
|
||||
metallic = texture(MRA, f_texcoord0).r;
|
||||
roughness = texture(MRA, f_texcoord0).g;
|
||||
specIntensity = texture(MRA, f_texcoord0).b;
|
||||
ao = texture(MRA, f_texcoord0).a;
|
||||
ao = texture(MRA, f_texcoord0).b;
|
||||
specIntensity = texture(MRA, f_texcoord0).a;
|
||||
}
|
||||
else if (HasShadowMap == 1)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue