1
0
mirror of synced 2024-11-27 17:00:50 +01:00

Update to the latest opengl framework and more bug fixes

This commit is contained in:
KillzXGaming 2019-04-05 19:47:21 -04:00
parent 8185fce35d
commit 7bea95b199
44 changed files with 842 additions and 283 deletions

1
.gitignore vendored
View File

@ -1,6 +1,7 @@
.vs/Switch_Toolbox/v15/Server/sqlite3/db.lock
*NodeEditorWinforms-master
*GL_EditorFramework-master
*.resources
Debug/
Release/

Binary file not shown.

View File

@ -234,9 +234,10 @@ namespace Bfres.Structs
if (IsWiiU)
{
fmdl.ModelU = new ResU.Model();
fmdl.ModelU = new ResU.Model();
fmdl.ModelU.Name = ResourceName;
fmdl.ModelU.Shapes.Add("", new ResU.Shape());
fmdl.ModelU.VertexBuffers.Add(new ResU.VertexBuffer());
var skeleton = new ResU.Skeleton();
@ -252,6 +253,8 @@ namespace Bfres.Structs
{
fmdl.Model = new ResNX.Model();
fmdl.Model.Name = ResourceName;
fmdl.Model.Shapes.Add(new ResNX.Shape());
fmdl.Model.VertexBuffers.Add(new ResNX.VertexBuffer());
//Create skeleton with empty bone
var skeleton = new ResNX.Skeleton();

View File

@ -103,7 +103,7 @@ namespace FirstPlugin
if (opn.ShowDialog() != DialogResult.OK) return;
var mod = EditorCore.Common.OBJ.Read(new MemoryStream(File.ReadAllBytes(opn.FileName)), null);
string name = Path.GetFileNameWithoutExtension(opn.FileName);
string name = System.IO.Path.GetFileNameWithoutExtension(opn.FileName);
var f = MarioKart.MK7.KCL.FromOBJ(mod);
@ -385,12 +385,14 @@ namespace FirstPlugin
public class KCLRendering : EditableObject
{
public Vector3 Position = new Vector3(0, 0, 0);
public Vector3 position = new Vector3(0, 0, 0);
protected bool Selected = false;
protected bool Hovered = false;
public override bool IsSelected() => Selected;
public override bool IsSelected(int partIndex) => Selected;
public bool IsHovered() => Selected;
// gl buffer objects
@ -554,12 +556,9 @@ namespace FirstPlugin
return;
}
public override void Draw(GL_ControlModern control, Pass pass)
{
public override void Draw(GL_ControlModern control, Pass pass) { }
}
public override void Draw(GL_ControlModern control, Pass pass, EditorScene editorScene)
public override void Draw(GL_ControlModern control, Pass pass, EditorSceneBase editorScene)
{
CheckBuffers();
@ -568,13 +567,15 @@ namespace FirstPlugin
control.CurrentShader = defaultShaderProgram;
control.UpdateModelMatrix(
Matrix4.CreateScale(Runtime.previewScale) *
Matrix4.CreateTranslation(Selected ? editorScene.currentAction.newPos(position) : position));
defaultShaderProgram.EnableVertexAttributes();
SetRenderSettings(defaultShaderProgram);
Matrix4 previewScale = Utils.TransformValues(Vector3.Zero, Vector3.Zero, Runtime.previewScale);
Matrix4 camMat = previewScale * control.mtxCam * control.mtxProj;
defaultShaderProgram.SetMatrix4x4("previewScale", ref previewScale);
Matrix4 camMat = control.ModelMatrix * control.CameraMatrix * control.ProjectionMatrix;
GL.Disable(EnableCap.CullFace);
@ -668,51 +669,78 @@ namespace FirstPlugin
GL.Uniform1(shader["colorOverride"], 0);
}
public override void ApplyTransformationToSelection(DeltaTransform deltaTransform)
{
Position += deltaTransform.Translation;
}
public override bool CanStartDragging() => true;
public override Vector3 GetSelectionCenter()
public override BoundingBox GetSelectionBox()
{
return Position;
Vector3 Min = new Vector3(0);
Vector3 Max = new Vector3(0);
foreach (var model in models)
{
foreach (var vertex in model.vertices)
{
Min.X = Math.Min(Min.X, vertex.pos.X);
Min.Y = Math.Min(Min.Y, vertex.pos.Y);
Min.Z = Math.Min(Min.Z, vertex.pos.Z);
Max.X = Math.Max(Min.X, vertex.pos.X);
Max.Y = Math.Max(Min.Y, vertex.pos.Y);
Max.Z = Math.Max(Min.Z, vertex.pos.Z);
}
}
return new BoundingBox()
{
minX = Min.X,
minY = Min.Y,
minZ = Min.Z,
maxX = Max.X,
maxY = Max.Y,
maxZ = Max.Z,
};
}
public override uint Select(int index, I3DControl control)
public override uint SelectAll(GL_ControlBase control)
{
Selected = true;
control.AttachPickingRedrawer();
return 0;
return REDRAW;
}
public override uint SelectDefault(I3DControl control)
public override uint SelectDefault(GL_ControlBase control)
{
Selected = true;
control.AttachPickingRedrawer();
return 0;
return REDRAW;
}
public override uint SelectAll(I3DControl control)
public override uint Select(int partIndex, GL_ControlBase control)
{
Selected = true;
control.AttachPickingRedrawer();
return 0;
return REDRAW;
}
public override uint Deselect(int index, I3DControl control)
public override uint Deselect(int partIndex, GL_ControlBase control)
{
Selected = false;
control.DetachPickingRedrawer();
return 0;
return REDRAW;
}
public override uint DeselectAll(I3DControl control)
public override uint DeselectAll(GL_ControlBase control)
{
Selected = false;
control.DetachPickingRedrawer();
return 0;
return REDRAW;
}
public override Vector3 Position
{
get
{
return position;
}
set
{
position = value;
}
}
}
@ -831,8 +859,5 @@ namespace FirstPlugin
}
}
}
}
}

View File

@ -21,14 +21,16 @@ namespace FirstPlugin
{
public class BFRESRender : EditableObject
{
public Matrix4 ModelTransform = Matrix4.Identity;
Vector3 Position;
public Matrix4 ModelTransform = Matrix4.Identity;
Vector3 position = new Vector3(0);
protected bool Selected = false;
public bool Hovered = false;
public override bool IsSelected() => Selected;
public override bool IsSelected(int partIndex) => Selected;
// gl buffer objects
int vbo_position;
int ibo_elements;
@ -37,10 +39,10 @@ namespace FirstPlugin
{
get
{
List<FMDL> fmdls = new List<FMDL>();
List<FMDL> fmdls = new List<FMDL>();
foreach (var node in ResFileNode.Nodes)
{
if (node is BFRESGroupNode &&
if (node is BFRESGroupNode &&
((BFRESGroupNode)node).Type == BRESGroupType.Models)
{
foreach (FMDL mdl in ((BFRESGroupNode)node).Nodes)
@ -84,7 +86,7 @@ namespace FirstPlugin
#region Rendering
public ShaderProgram BotwShaderProgram;
public ShaderProgram normalsShaderProgram;
public ShaderProgram debugShaderProgram;
@ -97,7 +99,7 @@ namespace FirstPlugin
string pathFrag = System.IO.Path.Combine(Runtime.ExecutableDir, "Shader", "Bfres") + "\\BFRES.frag";
string pathVert = System.IO.Path.Combine(Runtime.ExecutableDir, "Shader", "Bfres") + "\\BFRES.vert";
string pathBotwFrag = System.IO.Path.Combine(Runtime.ExecutableDir, "Shader", "Bfres") + "\\BFRES_Botw.frag";
string pathPbrFrag = System.IO.Path.Combine(Runtime.ExecutableDir, "Shader", "Bfres") + "\\BFRES_PBR.frag";
@ -107,7 +109,7 @@ namespace FirstPlugin
string pathUtiltyFrag = System.IO.Path.Combine(Runtime.ExecutableDir, "Shader", "Utility") + "\\Utility.frag";
string pathDebugFrag = System.IO.Path.Combine(Runtime.ExecutableDir, "Shader", "Bfres") + "\\BFRES_Debug.frag";
string pathNormalsFrag = System.IO.Path.Combine(Runtime.ExecutableDir, "Shader", "Bfres") + "\\Normals.frag";
@ -118,7 +120,7 @@ namespace FirstPlugin
var defaultVert = new VertexShader(System.IO.File.ReadAllText(pathVert));
var BotwtFrag = new FragmentShader(System.IO.File.ReadAllText(pathBotwFrag));
var shadowMapAGL = new FragmentShader(System.IO.File.ReadAllText(pathBfresTurboShadow));
var PbrFrag = new FragmentShader(System.IO.File.ReadAllText(pathPbrFrag));
@ -249,12 +251,15 @@ namespace FirstPlugin
return new Vector4(center, radius);
}
public override void Draw(GL_ControlModern control, Pass pass)
{
public override void Draw(GL_ControlModern control, Pass pass) {
DrawBfres(control, pass);
}
public override void Draw(GL_ControlModern control, Pass pass, EditorScene editorScene)
public override void Draw(GL_ControlModern control, Pass pass, EditorSceneBase editorScene) {
DrawBfres(control, pass);
}
private void DrawBfres(GL_ControlModern control, Pass pass)
{
if (!Runtime.OpenTKInitialized || pass == Pass.TRANSPARENT)
return;
@ -263,8 +268,6 @@ namespace FirstPlugin
if (!buffersWereInitialized)
GenerateBuffers();
Hovered = (editorScene.hovered == this);
if (Hovered == true)
throw new Exception("model selected");
@ -277,7 +280,7 @@ namespace FirstPlugin
{
if (models[0].shapes.Count > 0)
{
if( models[0].shapes[0].GetMaterial().shaderassign.ShaderModel == "uking_mat")
if (models[0].shapes[0].GetMaterial().shaderassign.ShaderModel == "uking_mat")
shader = BotwShaderProgram;
}
}
@ -288,12 +291,9 @@ namespace FirstPlugin
control.CurrentShader = shader;
control.UpdateModelMatrix(ModelTransform);
control.UpdateModelMatrix(Matrix4.CreateScale(Runtime.previewScale) * ModelTransform);
Matrix4 previewScale = Utils.TransformValues(Vector3.Zero, Vector3.Zero, Runtime.previewScale);
shader.SetMatrix4x4("previewScale", ref previewScale);
Matrix4 camMat = previewScale * control.mtxCam * control.mtxProj;
Matrix4 camMat = control.ModelMatrix * control.CameraMatrix * control.ProjectionMatrix;
Matrix4 sphereMatrix = camMat;
@ -305,8 +305,7 @@ namespace FirstPlugin
SetRenderSettings(shader);
Color pickingColor = control.nextPickingColor();
Vector4 pickingColor = control.nextPickingColor();
shader.SetVector3("difLightColor", new Vector3(1));
shader.SetVector3("ambLightColor", new Vector3(1));
@ -331,9 +330,12 @@ namespace FirstPlugin
{
control.CurrentShader = normalsShaderProgram;
Matrix4 projection = control.mtxProj;
Matrix4 projection = control.ProjectionMatrix;
Matrix4 camMtx = control.CameraMatrix;
normalsShaderProgram.SetMatrix4x4("mtxProj", ref projection);
normalsShaderProgram.SetMatrix4x4("camMtx", ref camMtx);
normalsShaderProgram.SetFloat("normalsLength", Runtime.normalsLineLength);
DrawModels(normalsShaderProgram, control);
@ -1075,51 +1077,81 @@ namespace FirstPlugin
GL.DrawElements(PrimitiveType.Triangles, p.lodMeshes[p.DisplayLODIndex].displayFaceSize, DrawElementsType.UnsignedInt, p.Offset);
}
public override void ApplyTransformationToSelection(DeltaTransform deltaTransform)
{
Position += deltaTransform.Translation;
}
public override bool CanStartDragging() => true;
public override Vector3 GetSelectionCenter()
public override BoundingBox GetSelectionBox()
{
return Position;
Vector3 Min = new Vector3(0);
Vector3 Max = new Vector3(0);
foreach (var model in models)
{
foreach (var shape in model.shapes)
{
foreach (var vertex in shape.vertices)
{
Min.X = Math.Min(Min.X, vertex.pos.X);
Min.Y = Math.Min(Min.Y, vertex.pos.Y);
Min.Z = Math.Min(Min.Z, vertex.pos.Z);
Max.X = Math.Max(Min.X, vertex.pos.X);
Max.Y = Math.Max(Min.Y, vertex.pos.Y);
Max.Z = Math.Max(Min.Z, vertex.pos.Z);
}
}
}
return new BoundingBox()
{
minX = Min.X,
minY = Min.Y,
minZ = Min.Z,
maxX = Max.X,
maxY = Max.Y,
maxZ = Max.Z,
};
}
public override uint Select(int index, I3DControl control)
public override uint SelectAll(GL_ControlBase control)
{
Selected = true;
control.AttachPickingRedrawer();
return 0;
return REDRAW;
}
public override uint SelectDefault(I3DControl control)
public override uint SelectDefault(GL_ControlBase control)
{
Selected = true;
control.AttachPickingRedrawer();
return 0;
return REDRAW;
}
public override uint SelectAll(I3DControl control)
public override uint Select(int partIndex, GL_ControlBase control)
{
Selected = true;
control.AttachPickingRedrawer();
return 0;
return REDRAW;
}
public override uint Deselect(int index, I3DControl control)
public override uint Deselect(int partIndex, GL_ControlBase control)
{
Selected = false;
control.DetachPickingRedrawer();
return 0;
return REDRAW;
}
public override uint DeselectAll(I3DControl control)
public override uint DeselectAll(GL_ControlBase control)
{
Selected = false;
control.DetachPickingRedrawer();
return 0;
return REDRAW;
}
public override Vector3 Position
{
get
{
return position;
}
set
{
position = value;
}
}
#endregion

View File

@ -51,7 +51,7 @@ namespace FirstPlugin
stPanel1.Dock = DockStyle.Fill;
}
if (byaml.FileName == "course_muunt.byaml" && useMuunt)
if (byaml.FileName == "course_muunt_debug.byaml" && useMuunt)
{
pathSupport = true;

View File

@ -3,17 +3,11 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using OpenGl_EditorFramework;
using OpenTK;
using System.ComponentModel;
namespace FirstPlugin.Turbo.CourseMuuntStructs
{
public interface IObj
{
dynamic this[string name] { get; set; }
}
public class CourseMuuntScene
{
private dynamic root;
@ -164,9 +158,83 @@ namespace FirstPlugin.Turbo.CourseMuuntStructs
set { root["OBJPrm8"] = value; }
}
public List<LapPathGroup> LapPaths;
public CourseMuuntScene(dynamic rootNode)
{
root = rootNode;
LapPaths = new List<LapPathGroup>();
if (root.ContainsKey("Area")) {
foreach (var area in root["Area"])
{ }
}
if (root.ContainsKey("Clip")) {
foreach (var clip in root["Clip"])
{ }
}
if (root.ContainsKey("ClipArea")) {
foreach (var clipArea in root["ClipArea"])
{ }
}
if (root.ContainsKey("ClipPattern")) {
foreach (var clipPattern in root["ClipPattern"])
{ }
}
if (root.ContainsKey("CurrentArea")) {
foreach (var currentArea in root["CurrentArea"])
{ }
}
if (root.ContainsKey("EffectArea")) {
foreach (var effectArea in root["EffectArea"])
{ }
}
if (root.ContainsKey("EnemyPath")) {
foreach (var enemyPath in root["EnemyPath"])
{ }
}
if (root.ContainsKey("GravityPath")) {
foreach (var gravityPath in root["GravityPath"])
{ }
}
if (root.ContainsKey("IntroCamera")) {
foreach (var introCamera in root["IntroCamera"])
{ }
}
if (root.ContainsKey("JugemPath")) {
foreach (var jugemPath in root["JugemPath"])
{ }
}
if (root.ContainsKey("LapPath")) {
foreach (var lapPath in root["LapPath"]) {
LapPaths.Add(new LapPathGroup(lapPath));
}
}
if (root.ContainsKey("MapObjIdList")) {
foreach (var mapObjIdList in root["MapObjIdList"])
{ }
}
if (root.ContainsKey("MapObjResList")) {
foreach (var mapObjResList in root["MapObjResList"])
{ }
}
if (root.ContainsKey("Obj")) {
foreach (var obj in root["Obj"])
{ }
}
if (root.ContainsKey("Path")) {
foreach (var path in root["Path"])
{ }
}
if (root.ContainsKey("ReplayCamera")) {
foreach (var replayCamera in root["ReplayCamera"])
{ }
}
if (root.ContainsKey("SoundObj")) {
foreach (var soundObj in root["SoundObj"])
{ }
}
}
@ -181,12 +249,18 @@ namespace FirstPlugin.Turbo.CourseMuuntStructs
public void AddRenderableKcl(string FilePath)
{
if (!System.IO.File.Exists(FilePath))
return;
KCL kcl = (KCL)Switch_Toolbox.Library.IO.STFileLoader.OpenFileFormat(FilePath);
KclObjects.Add(kcl);
}
public void AddRenderableBfres(string FilePath)
{
if (!System.IO.File.Exists(FilePath))
return;
BFRES bfres = (BFRES)Switch_Toolbox.Library.IO.STFileLoader.OpenFileFormat(FilePath);
BfresObjects.Add(bfres);
}
@ -201,24 +275,96 @@ namespace FirstPlugin.Turbo.CourseMuuntStructs
{
private dynamic root;
}
public class Path
public class LapPathGroup : IObject
{
public List<object> Properties = new List<object>();
public const string N_LapPathGroup = "LapPathGroup";
public const string N_ReturnPointsError = "ReturnPointsError";
public const string N_UnitIdNum = "UnitIdNum";
public List<PathPoint> PathPoints = new List<PathPoint>();
public List<ReturnPoint> ReturnPoints = new List<ReturnPoint>();
public LapPathGroup(dynamic bymlNode)
{
if (bymlNode is Dictionary<string, dynamic>) Prop = (Dictionary<string, dynamic>)bymlNode;
else throw new Exception("Not a dictionary");
foreach (var point in this["PathPt"]) {
PathPoints.Add(new PathPoint(point));
}
foreach (var point in this["ReturnPoints"]) {
ReturnPoints.Add(new ReturnPoint(point));
}
}
[Browsable(false)]
public Dictionary<string, dynamic> Prop { get; set; } = new Dictionary<string, dynamic>();
public int LapPathGroupId
{
get { return this[N_LapPathGroup]; }
set { this[N_LapPathGroup] = value; }
}
public int ReturnPointsError
{
get { return this[N_ReturnPointsError]; }
set { this[N_ReturnPointsError] = value; }
}
public int UnitIdNum
{
get { return this[N_UnitIdNum]; }
set { this[N_UnitIdNum] = value; }
}
public dynamic this[string name]
{
get
{
if (Prop.ContainsKey(name)) return Prop[name];
else return null;
}
set
{
if (Prop.ContainsKey(name)) Prop[name] = value;
else Prop.Add(name, value);
}
}
}
public class PathPoint : IObj
{
public const string N_Translate = "Translate";
public const string N_Rotate = "Rotate";
public const string N_Scale = "Scale";
public const string N_Id = "UnitIdNum";
public const string N_ObjectID = "ObjId";
public PathPoint(dynamic bymlNode)
public class PointID : IObject
{
public int PathID
{
get
{
return this["PathId"];
}
set
{
this["PathId"] = value;
}
}
public int PtID
{
get
{
return this["PtId"];
}
set
{
this["PtId"] = value;
}
}
public PointID(dynamic bymlNode)
{
if (bymlNode is Dictionary<string, dynamic>) Prop = (Dictionary<string, dynamic>)bymlNode;
else throw new Exception("Not a dictionary");
@ -240,60 +386,8 @@ namespace FirstPlugin.Turbo.CourseMuuntStructs
else Prop.Add(name, value);
}
}
public List<object> Properties = new List<object>();
public List<NextPoint> NextPoints = new List<NextPoint>();
public List<PrevPoint> PrevPoints = new List<PrevPoint>();
public List<ControlPoint> ControlPoints = new List<ControlPoint>();
[Category("Rotate")]
public Vector3 Rotate
{
get { return new Vector3(this[N_Rotate]["X"], this[N_Rotate]["Y"], this[N_Rotate]["Z"]); ; }
set
{
this[N_Rotate]["X"] = value.X;
this[N_Rotate]["Y"] = value.Y;
this[N_Rotate]["Z"] = value.Z;
}
}
[Category("Scale")]
public Vector3 Scale
{
get { return new Vector3(this[N_Scale]["X"], this[N_Scale]["Y"], this[N_Scale]["Z"]); ; }
set
{
this[N_Scale]["X"] = value.X;
this[N_Scale]["Y"] = value.Y;
this[N_Scale]["Z"] = value.Z;
}
}
[Category("Translate")]
public Vector3 Translate
{
get { return new Vector3(this[N_Translate]["X"], this[N_Translate]["Y"], this[N_Translate]["Z"]); ; }
set
{
this[N_Translate]["X"] = value.X;
this[N_Translate]["Y"] = value.Y;
this[N_Translate]["Z"] = value.Z;
}
}
}
public class PointId
{
public int PathID { get; set; } //For groups
public int PtID { get; set; } //For points
}
public class NextPoint : PointId { };
public class PrevPoint : PointId { };
public class ControlPoint
{
public Vector3 Point1;

View File

@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FirstPlugin.Turbo.CourseMuuntStructs
{
public interface IObject
{
dynamic this[string name] { get; set; }
}
}

View File

@ -0,0 +1,92 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using OpenTK;
using GL_EditorFramework.EditorDrawables;
namespace FirstPlugin.Turbo.CourseMuuntStructs
{
public class PathPoint : IObject
{
public RenderablePathPoint RenderablePoint
{
get
{
return new RenderablePathPoint(Translate, Rotate, Scale);
}
}
public const string N_Translate = "Translate";
public const string N_Rotate = "Rotate";
public const string N_Scale = "Scale";
public const string N_Id = "UnitIdNum";
public const string N_ObjectID = "ObjId";
public PathPoint(dynamic bymlNode)
{
if (bymlNode is Dictionary<string, dynamic>) Prop = (Dictionary<string, dynamic>)bymlNode;
else throw new Exception("Not a dictionary");
}
[Browsable(false)]
public Dictionary<string, dynamic> Prop { get; set; } = new Dictionary<string, dynamic>();
public dynamic this[string name]
{
get
{
if (Prop.ContainsKey(name)) return Prop[name];
else return null;
}
set
{
if (Prop.ContainsKey(name)) Prop[name] = value;
else Prop.Add(name, value);
}
}
public List<object> Properties = new List<object>();
public List<PointID> NextPoints = new List<PointID>();
public List<PointID> PrevPoints = new List<PointID>();
public List<ControlPoint> ControlPoints = new List<ControlPoint>();
[Category("Rotate")]
public Vector3 Rotate
{
get { return new Vector3(this[N_Rotate]["X"], this[N_Rotate]["Y"], this[N_Rotate]["Z"]); ; }
set
{
this[N_Rotate]["X"] = value.X;
this[N_Rotate]["Y"] = value.Y;
this[N_Rotate]["Z"] = value.Z;
}
}
[Category("Scale")]
public Vector3 Scale
{
get { return new Vector3(this[N_Scale]["X"], this[N_Scale]["Y"], this[N_Scale]["Z"]); ; }
set
{
this[N_Scale]["X"] = value.X;
this[N_Scale]["Y"] = value.Y;
this[N_Scale]["Z"] = value.Z;
}
}
[Category("Translate")]
public Vector3 Translate
{
get { return new Vector3(this[N_Translate]["X"], this[N_Translate]["Y"], this[N_Translate]["Z"]); ; }
set
{
this[N_Translate]["X"] = value.X;
this[N_Translate]["Y"] = value.Y;
this[N_Translate]["Z"] = value.Z;
}
}
}
}

View File

@ -0,0 +1,173 @@
using Gl_EditorFramework;
using GL_EditorFramework.GL_Core;
using GL_EditorFramework.Interfaces;
using OpenTK;
using OpenTK.Graphics.OpenGL;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Switch_Toolbox.Library.IO;
using static GL_EditorFramework.EditorDrawables.EditorSceneBase;
namespace GL_EditorFramework.EditorDrawables
{
//
// Summary:
// An EditableObject that has only one selectable Part. It's represented by a blue block
public class RenderablePathPoint : SingleObject
{
public RenderablePathPoint(Vector3 pos)
: base(pos)
{
}
protected Vector3 ScaleVec3 = new Vector3(0, 0, 0);
protected Vector3 RotationVec3 = new Vector3(0, 0, 0);
protected Vector3 Normal = new Vector3(0, 0, 0);
protected Vector3 Tangent = new Vector3(0, 0, 0);
bool IsNormalTanTransform = false;
protected bool Selected = false;
public override bool IsSelected() => Selected;
public override bool IsSelected(int partIndex) => Selected;
protected static Vector4 Color = new Vector4(0f, 0.25f, 1f, 1f);
Matrix4 Transform;
public RenderablePathPoint(Vector3 pos, Vector3 rot, Vector3 scale) : base(pos)
{
UpdateTransform(pos, rot, scale);
}
public RenderablePathPoint(Vector3 pos, Vector3 normal, Vector3 tangent, Vector3 scale) : base(pos)
{
UpdateTransform(pos, normal, tangent, scale);
}
public void UpdateTransform(Vector3 pos, Vector3 rot, Vector3 scale)
{
Position = pos;
RotationVec3 = rot;
ScaleVec3 = new Vector3(scale / 2);
}
public void UpdateTransform(Vector3 pos, Vector3 normal, Vector3 tangent, Vector3 scale)
{
IsNormalTanTransform = true;
Normal = normal;
Tangent = tangent;
ScaleVec3 = new Vector3(scale / 2);
}
public override void Draw(GL_ControlModern control, Pass pass, EditorSceneBase editorScene)
{
if (pass == Pass.TRANSPARENT)
return;
bool hovered = editorScene.hovered == this;
if (IsNormalTanTransform)
{
control.UpdateModelMatrix(Matrix4.CreateScale(ScaleVec3) *
MatrixExenstion.CreateRotation(Normal, Tangent) *
Matrix4.CreateTranslation(Selected ? editorScene.currentAction.newPos(Position) : Position));
}
else
{
control.UpdateModelMatrix(Matrix4.CreateScale(ScaleVec3) *
(Matrix4.CreateRotationX(RotationVec3.X) *
Matrix4.CreateRotationY(RotationVec3.Y) *
Matrix4.CreateRotationZ(RotationVec3.Z)) *
Matrix4.CreateTranslation(Selected ? editorScene.currentAction.newPos(Position) : Position));
}
Vector4 blockColor;
Vector4 lineColor;
if (hovered && Selected)
lineColor = hoverColor;
else if (hovered || Selected)
lineColor = selectColor;
else
lineColor = Color;
if (hovered && Selected)
blockColor = Color * 0.5f + hoverColor * 0.5f;
else if (hovered || Selected)
blockColor = Color * 0.5f + selectColor * 0.5f;
else
blockColor = Color;
Renderers.ColorBlockRenderer.Draw(control, pass, blockColor, lineColor, control.nextPickingColor());
}
public override void Draw(GL_ControlModern control, Pass pass)
{
if (pass == Pass.TRANSPARENT)
return;
control.UpdateModelMatrix(Matrix4.CreateScale(0.5f) *
Matrix4.CreateTranslation(position));
Renderers.ColorBlockRenderer.Draw(control, pass, Color, Color, control.nextPickingColor());
}
public override void Draw(GL_ControlLegacy control, Pass pass, EditorSceneBase editorScene)
{
if (pass == Pass.TRANSPARENT)
return;
bool hovered = editorScene.hovered == this;
control.UpdateModelMatrix(Matrix4.CreateScale(0.5f) *
Matrix4.CreateTranslation(Selected ? editorScene.currentAction.newPos(position) : position));
Vector4 blockColor;
Vector4 lineColor;
if (hovered && Selected)
lineColor = hoverColor;
else if (hovered || Selected)
lineColor = selectColor;
else
lineColor = Color;
if (hovered && Selected)
blockColor = Color * 0.5f + hoverColor * 0.5f;
else if (hovered || Selected)
blockColor = Color * 0.5f + selectColor * 0.5f;
else
blockColor = Color;
Renderers.ColorBlockRenderer.Draw(control, pass, blockColor, lineColor, control.nextPickingColor());
}
public override void Draw(GL_ControlLegacy control, Pass pass)
{
if (pass == Pass.TRANSPARENT)
return;
control.UpdateModelMatrix(Matrix4.CreateScale(0.5f) *
Matrix4.CreateTranslation(position));
Renderers.ColorBlockRenderer.Draw(control, pass, Color, Color, control.nextPickingColor());
}
public override void ApplyTransformActionToSelection(AbstractTransformAction transformAction)
{
Position = transformAction.newPos(Position);
Scale = transformAction.newScale(Scale);
}
}
}

View File

@ -0,0 +1,103 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using OpenTK;
namespace FirstPlugin.Turbo.CourseMuuntStructs
{
public class ReturnPoint : IObject
{
public const string N_Normal = "Normal";
public const string N_Position = "Position";
public const string N_Tangent = "Tangent";
public const string N_JugemIndex = "JugemIndex";
public const string N_JugemPath = "JugemPath";
public const string N_ReturnType = "ReturnType";
public const string N_HasError = "hasError";
public ReturnPoint(dynamic bymlNode)
{
if (bymlNode is Dictionary<string, dynamic>) Prop = (Dictionary<string, dynamic>)bymlNode;
else throw new Exception("Not a dictionary");
}
[Browsable(false)]
public Dictionary<string, dynamic> Prop { get; set; } = new Dictionary<string, dynamic>();
public dynamic this[string name]
{
get
{
if (Prop.ContainsKey(name)) return Prop[name];
else return null;
}
set
{
if (Prop.ContainsKey(name)) Prop[name] = value;
else Prop.Add(name, value);
}
}
public List<object> Properties = new List<object>();
public List<ControlPoint> ControlPoints = new List<ControlPoint>();
public int JugemIndex
{
get { return this[N_JugemIndex]; }
set { this[N_JugemIndex] = value; }
}
public int JugemPath
{
get { return this[N_JugemPath]; }
set { this[N_JugemPath] = value; }
}
public int ReturnType
{
get { return this[N_ReturnType]; }
set { this[N_ReturnType] = value; }
}
public int HasError
{
get { return this[N_HasError]; }
set { this[N_HasError] = value; }
}
public Vector3 Normal
{
get { return new Vector3(this[N_Normal]["X"], this[N_Normal]["Y"], this[N_Normal]["Z"]); ; }
set
{
this[N_Normal]["X"] = value.X;
this[N_Normal]["Y"] = value.Y;
this[N_Normal]["Z"] = value.Z;
}
}
public Vector3 Position
{
get { return new Vector3(this[N_Position]["X"], this[N_Position]["Y"], this[N_Position]["Z"]); ; }
set
{
this[N_Position]["X"] = value.X;
this[N_Position]["Y"] = value.Y;
this[N_Position]["Z"] = value.Z;
}
}
public Vector3 Tangent
{
get { return new Vector3(this[N_Tangent]["X"], this[N_Tangent]["Y"], this[N_Tangent]["Z"]); ; }
set
{
this[N_Tangent]["X"] = value.X;
this[N_Tangent]["Y"] = value.Y;
this[N_Tangent]["Z"] = value.Z;
}
}
}
}

View File

@ -31,8 +31,8 @@ namespace FirstPlugin.Forms
scene = new CourseMuuntScene(by);
if (File.Exists($"{CourseFolder}/course_model.szs"))
{
scene.AddRenderableBfres($"{CourseFolder}/course_model.szs");
scene.AddRenderableKcl($"{CourseFolder}/course.kcl");
// scene.AddRenderableBfres($"{CourseFolder}/course_model.szs");
// scene.AddRenderableKcl($"{CourseFolder}/course.kcl");
foreach (var kcl in scene.KclObjects)
@ -54,6 +54,23 @@ namespace FirstPlugin.Forms
objectCB.Items.Add("Scene");
objectCB.SelectedIndex = 0;
if (scene.LapPaths.Count > 0)
{
objectCB.Items.Add("Lap Paths");
foreach (var group in scene.LapPaths)
{
foreach (var path in group.PathPoints)
{
Console.WriteLine(path.Translate);
Console.WriteLine(path.Rotate);
Console.WriteLine(path.Scale);
viewport.AddDrawable(path.RenderablePoint);
}
}
}
}
private void objectCB_SelectedIndexChanged(object sender, EventArgs e)
@ -66,6 +83,16 @@ namespace FirstPlugin.Forms
{
stPropertyGrid1.LoadProperty(scene, OnPropertyChanged);
}
if (Text == "Lap Paths")
{
stPropertyGrid1.LoadProperty(scene, OnPropertyChanged);
listViewCustom1.Items.Clear();
for (int i = 0; i < scene.LapPaths.Count; i++)
{
listViewCustom1.Items.Add("Lap Path Group " + i);
}
}
}
}

View File

@ -76,6 +76,9 @@
<HintPath>..\Toolbox\Lib\EditorCoreCommon.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Gl_EditorFramework">
<HintPath>..\Toolbox\Gl_EditorFramework.dll</HintPath>
</Reference>
<Reference Include="KCLExt">
<HintPath>..\Toolbox\Lib\KCLExt.dll</HintPath>
<Private>False</Private>
@ -98,9 +101,6 @@
<HintPath>..\Toolbox\Lib\ObjectListView.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="OpenGl_EditorFramework">
<HintPath>..\Toolbox\OpenGl_EditorFramework.dll</HintPath>
</Reference>
<Reference Include="OpenTK">
<HintPath>..\Toolbox\Lib\OpenTK.dll</HintPath>
<Private>False</Private>
@ -328,11 +328,15 @@
<Compile Include="GUI\BFRES\TexturePattern\TexPatternMaterialEditor.Designer.cs">
<DependentUpon>TexPatternMaterialEditor.cs</DependentUpon>
</Compile>
<Compile Include="GUI\Byaml\CourseMuuntStructs.cs" />
<Compile Include="GUI\Byaml\TurboMunntEditor.cs">
<Compile Include="GUI\Byaml\CourseMuunt\CourseMuuntStructs.cs" />
<Compile Include="GUI\Byaml\CourseMuunt\IObject.cs" />
<Compile Include="GUI\Byaml\CourseMuunt\RenderablePathPoint.cs" />
<Compile Include="GUI\Byaml\CourseMuunt\ReturnPoint.cs" />
<Compile Include="GUI\Byaml\CourseMuunt\PathPoint.cs" />
<Compile Include="GUI\Byaml\CourseMuunt\TurboMunntEditor.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="GUI\Byaml\TurboMunntEditor.Designer.cs">
<Compile Include="GUI\Byaml\CourseMuunt\TurboMunntEditor.Designer.cs">
<DependentUpon>TurboMunntEditor.cs</DependentUpon>
</Compile>
<Compile Include="MarioCostumeEditor.cs" />
@ -919,7 +923,7 @@
<EmbeddedResource Include="GUI\BFRES\TexturePattern\TexPatternMaterialEditor.resx">
<DependentUpon>TexPatternMaterialEditor.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="GUI\Byaml\TurboMunntEditor.resx">
<EmbeddedResource Include="GUI\Byaml\CourseMuunt\TurboMunntEditor.resx">
<DependentUpon>TurboMunntEditor.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="GUI\BFRES\ParamAnim\AnimParamEditor.resx">

View File

@ -1 +1 @@
f4a1b63268d74ea1a3a7f1cd09b7a17ff1e990b4
e642c59851624ad96c53b6fc10b001a8b8197297

View File

@ -141,7 +141,7 @@ namespace Switch_Toolbox.Library
if (UseSkybox)
{
var skybox = new DrawableSkybox();
scene.staticObjects.Add(skybox);
// scene.staticObjects.Add(skybox);
}
else if (Runtime.renderBackGround)
{
@ -149,7 +149,9 @@ namespace Switch_Toolbox.Library
scene.staticObjects.Add(background);
}
LoadFog();
// scene.objects.Add(new SingleObject(new Vector3(0, 0, 0)));
// LoadFog();
Runtime.OpenTKInitialized = true;
}

View File

@ -15,12 +15,14 @@ namespace Switch_Toolbox.Library
{
public class STSkeleton : EditableObject
{
public Vector3 Position = new Vector3(0, 0, 0);
public Vector3 position = new Vector3(0, 0, 0);
protected bool Selected = false;
protected bool Hovered = false;
public override bool IsSelected() => Selected;
public override bool IsSelected(int partIndex) => Selected;
public bool IsHovered() => Selected;
public ShaderProgram solidColorShaderProgram;
@ -42,7 +44,6 @@ namespace Switch_Toolbox.Library
uniform mat4 mtxCam;
uniform mat4 mtxMdl;
uniform mat4 previewScale;
uniform mat4 bone;
uniform mat4 parent;
@ -59,7 +60,7 @@ namespace Switch_Toolbox.Library
else
position = bone * rotation * vec4((point.xyz - vec3(0, 1, 0)) * scale, 1);
}
gl_Position = mtxCam * mtxMdl * previewScale * vec4(position.xyz, 1);
gl_Position = mtxCam * mtxMdl * vec4(position.xyz, 1);
}");
@ -80,15 +81,14 @@ namespace Switch_Toolbox.Library
GL.DeleteBuffer(vbo_position);
}
public override void Draw(GL_ControlLegacy control, Pass pass, EditorScene editorScene)
public override void Draw(GL_ControlLegacy control, Pass pass, EditorSceneBase editorScene)
{
if (!Runtime.OpenTKInitialized || pass == Pass.TRANSPARENT)
return;
foreach (STBone bn in bones)
{
if (bn.Checked)
bn.Render();
bn.Render();
}
}
@ -99,47 +99,12 @@ namespace Switch_Toolbox.Library
foreach (STBone bn in bones)
{
if (bn.Checked)
bn.Render();
bn.Render();
}
}
private static List<Vector4> screenPositions = new List<Vector4>()
{
/* new Vector4(-1f, 1f, -1f, 0),
new Vector4(1f, 1f, -1f, 0),
new Vector4(1f, 1f, 1f, 0),
new Vector4(-1f, 1f, 1f, 0),
new Vector4(-1f, -1f, 1f, 0),
new Vector4(1f, -1f, 1f, 0),
new Vector4(1f, -1f, -1f, 0),
new Vector4(-1f, -1f, -1f, 0),
new Vector4(-1f, 1f, 1f, 0),
new Vector4(1f, 1f, 1f, 0),
new Vector4(1f, -1f, 1f, 0),
new Vector4(-1f, -1f, 1f, 0),
new Vector4(1f, 1f, -1f, 0),
new Vector4(-1f, 1f, -1f, 0),
new Vector4(-1f, -1f, -1f, 0),
new Vector4(1f, -1f, -1f, 0),
new Vector4(1f, 1f, 1f, 0),
new Vector4(1f, 1f, -1f, 0),
new Vector4(1f, -1f, -1f, 0),
new Vector4(1f, -1f, 1f, 0),
new Vector4(-1f, 1f, -1f, 0),
new Vector4(-1f, 1f, 1f, 0),
new Vector4(-1f, -1f, 1f, 0),
new Vector4(-1f, -1f, -1f, 0),
*/
// cube
new Vector4(0f, 0f, -1f, 0),
new Vector4(1f, 0f, 0f, 0),
@ -222,11 +187,11 @@ namespace Switch_Toolbox.Library
Color boneColor = Color.FromArgb(255, 240, 240, 0);
Color selectedBoneColor = Color.FromArgb(255, 240, 240, 240);
public override void Draw(GL_ControlModern control, Pass pass, EditorScene editorScene)
public override void Draw(GL_ControlModern control, Pass pass, EditorSceneBase editorScene)
{
CheckBuffers();
if (!Runtime.OpenTKInitialized || !Runtime.renderBones || solidColorShaderProgram == null)
if (!Runtime.OpenTKInitialized || !Runtime.renderBones)
return;
GL.UseProgram(0);
@ -237,20 +202,19 @@ namespace Switch_Toolbox.Library
control.CurrentShader = solidColorShaderProgram;
Matrix4 previewScale = Utils.TransformValues(Vector3.Zero, Vector3.Zero, Runtime.previewScale);
control.UpdateModelMatrix(
Matrix4.CreateScale(Runtime.previewScale) *
Matrix4.CreateTranslation(Selected ? editorScene.currentAction.newPos(position) : position));
solidColorShaderProgram.EnableVertexAttributes();
solidColorShaderProgram.SetMatrix4x4("rotation", ref prismRotation);
solidColorShaderProgram.SetMatrix4x4("previewScale", ref previewScale);
foreach (STBone bn in bones)
{
if (!bn.Checked)
continue;
solidColorShaderProgram.SetVector4("boneColor", ColorUtility.ToVector4(boneColor));
solidColorShaderProgram.SetFloat("scale", Runtime.bonePointSize);
Matrix4 transform = bn.Transform;
solidColorShaderProgram.SetMatrix4x4("bone", ref transform);
@ -451,51 +415,64 @@ namespace Switch_Toolbox.Library
}
}
public override void ApplyTransformationToSelection(DeltaTransform deltaTransform)
{
Position += deltaTransform.Translation;
}
public override bool CanStartDragging() => true;
public override Vector3 GetSelectionCenter()
public override BoundingBox GetSelectionBox()
{
return Position;
Vector3 Min = new Vector3(0);
Vector3 Max = new Vector3(99999);
return new BoundingBox()
{
minX = Min.X,
minY = Min.Y,
minZ = Min.Z,
maxX = Max.X,
maxY = Max.Y,
maxZ = Max.Z,
};
}
public override uint Select(int index, I3DControl control)
public override uint SelectAll(GL_ControlBase control)
{
Selected = true;
control.AttachPickingRedrawer();
return 0;
return REDRAW;
}
public override uint SelectDefault(I3DControl control)
public override uint SelectDefault(GL_ControlBase control)
{
Selected = true;
control.AttachPickingRedrawer();
return 0;
return REDRAW;
}
public override uint SelectAll(I3DControl control)
public override uint Select(int partIndex, GL_ControlBase control)
{
Selected = true;
control.AttachPickingRedrawer();
return 0;
return REDRAW;
}
public override uint Deselect(int index, I3DControl control)
public override uint Deselect(int partIndex, GL_ControlBase control)
{
Selected = false;
control.DetachPickingRedrawer();
return 0;
return REDRAW;
}
public override uint DeselectAll(I3DControl control)
public override uint DeselectAll(GL_ControlBase control)
{
Selected = false;
control.DetachPickingRedrawer();
return 0;
return REDRAW;
}
public override Vector3 Position
{
get
{
return position;
}
set
{
position = value;
}
}
}
}

View File

@ -9,6 +9,24 @@ namespace Switch_Toolbox.Library.IO
{
public static class MatrixExenstion
{
public static OpenTK.Matrix4 CreateRotation(OpenTK.Vector3 Normal, OpenTK.Vector3 Tangent)
{
var mat4 = OpenTK.Matrix4.Identity;
var vec3 = OpenTK.Vector3.Cross(Normal, Tangent);
mat4.M11 = Tangent.X;
mat4.M21 = Tangent.Y;
mat4.M31 = Tangent.Z;
mat4.M12 = Normal.X;
mat4.M22 = Normal.Y;
mat4.M32 = Normal.Z;
mat4.M13 = vec3.X;
mat4.M23 = vec3.Y;
mat4.M33 = vec3.Z;
return mat4;
}
public static Syroot.Maths.Matrix3x4 GetMatrixInverted(STBone bone)
{
return ToMatrix3x4(CalculateInverseMatrix(bone).inverse);

View File

@ -144,7 +144,7 @@ namespace Switch_Toolbox.Library.Rendering
control.CurrentShader = solidColorShaderProgram;
Matrix4 previewScale = Utils.TransformValues(Vector3.Zero, Vector3.Zero, Runtime.previewScale);
Matrix4 camMat = control.mtxCam * control.mtxProj;
Matrix4 camMat = control.ModelMatrix * control.ProjectionMatrix;
Matrix4 invertedCamera = camMat.Inverted();
Vector3 lightDirection = new Vector3(0f, 0f, -1f);

View File

@ -21,7 +21,7 @@ namespace Switch_Toolbox.Library.Rendering
Texture,
}
protected static ShaderProgram solidColorShaderProgram;
private ShaderProgram gridShaderProgram;
int vbo_position;
@ -84,23 +84,20 @@ namespace Switch_Toolbox.Library.Rendering
if (!Runtime.OpenTKInitialized)
return;
GL.Disable(EnableCap.CullFace);
// GL.Disable(EnableCap.CullFace);
control.CurrentShader = solidColorShaderProgram;
control.CurrentShader = gridShaderProgram;
Matrix4 previewScale = Utils.TransformValues(Vector3.Zero, Vector3.Zero, Runtime.previewScale);
Matrix4 camMat = control.mtxCam * control.mtxProj;
Matrix4 invertedCamera = camMat.Inverted();
Vector3 lightDirection = new Vector3(0f, 0f, -1f);
gridShaderProgram.SetMatrix4x4("previewScale", ref previewScale);
solidColorShaderProgram.SetMatrix4x4("mvpMatrix", ref camMat);
solidColorShaderProgram.EnableVertexAttributes();
Draw(solidColorShaderProgram);
solidColorShaderProgram.DisableVertexAttributes();
gridShaderProgram.EnableVertexAttributes();
Draw(gridShaderProgram);
gridShaderProgram.DisableVertexAttributes();
GL.UseProgram(0);
GL.Enable(EnableCap.CullFace);
// GL.Enable(EnableCap.CullFace);
}
private void Attributes(ShaderProgram shader)
@ -163,13 +160,15 @@ namespace Switch_Toolbox.Library.Rendering
var solidColorVert = new VertexShader(
@"#version 330
in vec3 vPosition;
uniform mat4 mvpMatrix;
uniform mat4 mtxMdl;
uniform mat4 mtxCam;
void main(){
gl_Position = mvpMatrix * vec4(vPosition.xyz, 1);
gl_Position = mtxMdl * mtxCam * vec4(vPosition.xyz, 1);
}");
solidColorShaderProgram = new ShaderProgram(solidColorFrag, solidColorVert);
gridShaderProgram = new ShaderProgram(solidColorFrag, solidColorVert);
}
public override void Prepare(GL_ControlLegacy control)

View File

@ -60,7 +60,7 @@ namespace Switch_Toolbox.Library.Rendering
GL.Enable(EnableCap.TextureCubeMapSeamless);
Matrix4 proj = Matrix4.Identity;
Matrix4 rot = Matrix4.CreateFromQuaternion(control.mtxCam.ExtractRotation());
Matrix4 rot = Matrix4.CreateFromQuaternion(control.ModelMatrix.ExtractRotation());
GL.UniformMatrix4(defaultShaderProgram["projection"], false, ref proj);
GL.UniformMatrix4(defaultShaderProgram["rotView"], false, ref rot);

View File

@ -57,6 +57,9 @@
<HintPath>..\packages\DirectXTexNet.1.0.0-rc2\lib\net40\DirectXTexNet.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Gl_EditorFramework">
<HintPath>..\Toolbox\Gl_EditorFramework.dll</HintPath>
</Reference>
<Reference Include="ICSharpCode.SharpZipLib, Version=1.1.0.145, Culture=neutral, PublicKeyToken=1b03e6acf1164f73, processorArchitecture=MSIL">
<HintPath>..\packages\SharpZipLib.1.1.0\lib\net45\ICSharpCode.SharpZipLib.dll</HintPath>
<Private>False</Private>
@ -96,11 +99,6 @@
<HintPath>..\Toolbox\Lib\Octokit.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="OpenGl_EditorFramework, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\Toolbox\OpenGl_EditorFramework.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="OpenTK">
<HintPath>..\Toolbox\Lib\OpenTK.dll</HintPath>
<Private>False</Private>

Binary file not shown.

Binary file not shown.

View File

@ -233,7 +233,18 @@ namespace Toolbox
SetFormatSettings((IFileFormat)node);
//Check for active object editors
ObjectEditor editor = (ObjectEditor)LibraryGUI.Instance.GetActiveForm();
Form editor = (Form)LibraryGUI.Instance.GetActiveForm();
bool useActiveEditor = false;
if (editor != null && editor is ObjectEditor)
{
//If any are active and we want it to be a new tab then create an instance of one
if (InActiveEditor || ((ObjectEditor)editor).AddFilesToActiveEditor)
{
useActiveEditor = true;
}
}
bool IsEditorActive = editor != null;
@ -243,25 +254,17 @@ namespace Toolbox
editor = new ObjectEditor();
}
bool useActiveEditor = false;
//If any are active and we want it to be a new tab then create an instance of one
if (InActiveEditor || editor.AddFilesToActiveEditor)
{
useActiveEditor = true;
}
if (!useActiveEditor || !IsEditorActive)
{
editor = new ObjectEditor();
AddObjectEditorFile(node, editor, true);
AddObjectEditorFile(node, (ObjectEditor)editor, true);
editor.Text = CheckTabDupes(node.Text);
editor.Show();
}
else
{
AddObjectEditorFile(node, editor, false);
AddObjectEditorFile(node, (ObjectEditor)editor, false);
}
SetFormatSettings(GetActiveIFileFormat());

Binary file not shown.

Binary file not shown.

View File

@ -3,7 +3,6 @@
uniform mat4 mtxCam;
uniform mat4 mtxMdl;
uniform mat4 sphereMatrix;
uniform mat4 previewScale;
//This may not be correct, however any SRT used with this flag is used for special effects not supported yet!
uniform float fuv1_mtx;
@ -139,7 +138,7 @@ void main()
if (vBone.x != -1.0)
objPos = skin(vPosition, index);
vec4 position = mtxCam * mtxMdl * previewScale * vec4(objPos.xyz, 1.0);
vec4 position = mtxCam * mtxMdl * vec4(objPos.xyz, 1.0);
normal = vNormal;
viewNormal = mat3(sphereMatrix) * normal.xyz;
@ -150,12 +149,12 @@ void main()
if (RigidSkinning == 1)
{
position = mtxCam * mtxMdl * previewScale * (bones[index.x] * vec4(vPosition, 1.0));
position = mtxCam * mtxMdl * (bones[index.x] * vec4(vPosition, 1.0));
normal = mat3(bones[index.x]) * vNormal.xyz * 1;
}
if (NoSkinning == 1)
{
position = mtxCam * mtxMdl * previewScale * (SingleBoneBindTransform * vec4(vPosition, 1.0));
position = mtxCam * mtxMdl * (SingleBoneBindTransform * vec4(vPosition, 1.0));
normal = mat3(SingleBoneBindTransform) * vNormal.xyz * 1;
//normal = normalize(normal);
}

View File

@ -20,7 +20,7 @@ out VS_OUT {
uniform mat4 mtxProj;
uniform mat4 mtxCam;
uniform mat4 mtxMdl;
uniform mat4 mtxCamTest;
uniform mat4 camMtx;
// Skinning uniforms
uniform mat4 bones[200];
@ -76,6 +76,6 @@ void main()
gl_Position = mtxCam * mtxMdl * vec4(objPos.xyz, 1.0);
mat3 normalMatrix = mat3(transpose(inverse(mtxCamTest * mtxMdl)));
mat3 normalMatrix = mat3(transpose(inverse(camMtx * mtxMdl)));
vs_out.normal = normalize(vec3(mtxProj * vec4(normalMatrix * normal, 0.0)));
}

View File

@ -20,7 +20,7 @@ void main()
color = vColor;
position = vPosition;
gl_Position = mtxCam * mtxMdl * previewScale * vec4(vPosition.xyz, 1.0);
gl_Position = mtxCam * mtxMdl * vec4(vPosition.xyz, 1.0);
vec3 distance = (vPosition.xyz + vec3(5, 5, 5))/2;

View File

@ -221,6 +221,9 @@
<Content Include="Assimp64.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Gl_EditorFramework.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="libzstd.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
@ -379,12 +382,6 @@
<Content Include="LZ4.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="OpenGl_EditorFramework.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="OpenGl_EditorFramework.pdb">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Projects\Recent\DUMMY.txt" />
<Content Include="Lib\x64\DirectXTexNetImpl.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
@ -394,7 +391,6 @@
</Content>
<None Include="Resources\Save.png" />
<None Include="Resources\UpdateIcon.png" />
<Content Include="skeleton_dQ9_icon.ico" />
<Content Include="Switch_Toolbox.csproj.user" />
<Content Include="Tool.ico" />
<None Include="Resources\Logo.png" />

View File

@ -30,7 +30,7 @@ after_build:
- 7z a "Switch-Toolbox-Latest.zip" "%APPVEYOR_BUILD_FOLDER%\Toolbox\bin\Release\Assimp32.dll"
- 7z a "Switch-Toolbox-Latest.zip" "%APPVEYOR_BUILD_FOLDER%\Toolbox\bin\Release\libzstd.dll"
- 7z a "Switch-Toolbox-Latest.zip" "%APPVEYOR_BUILD_FOLDER%\Toolbox\bin\Release\LZ4.dll"
- 7z a "Switch-Toolbox-Latest.zip" "%APPVEYOR_BUILD_FOLDER%\Toolbox\bin\Release\OpenGl_EditorFramework.dll"
- 7z a "Switch-Toolbox-Latest.zip" "%APPVEYOR_BUILD_FOLDER%\Toolbox\bin\Release\Gl_EditorFramework.dll"
- 7z a "Switch-Toolbox-Latest.zip" "%APPVEYOR_BUILD_FOLDER%\Toolbox\bin\Release\Switch_Toolbox.Library.dll"
- 7z a "Switch-Toolbox-Latest.zip" "%APPVEYOR_BUILD_FOLDER%\Toolbox\bin\Release\System.Buffers.dll"
- 7z a "Switch-Toolbox-Latest.zip" "%APPVEYOR_BUILD_FOLDER%\Toolbox\bin\Release\System.Memory.dll"