1
0
mirror of synced 2025-02-26 14:51:47 +01:00

Update simple mode for bfres editor. Disable some gx2 things to test swizzle issues

This commit is contained in:
KillzXGaming 2019-04-16 18:24:10 -04:00
parent 4f07ddf490
commit 67f713bf22
18 changed files with 154 additions and 11 deletions

Binary file not shown.

View File

@ -85,12 +85,12 @@ namespace FirstPlugin
if (editExt[0].Checked)
{
editExt[0].Checked = false;
// PluginRuntime.UseSimpleBfresEditor = true;
PluginRuntime.UseSimpleBfresEditor = true;
}
else
{
editExt[0].Checked = true;
// PluginRuntime.UseSimpleBfresEditor = false;
PluginRuntime.UseSimpleBfresEditor = false;
}
}
private void NewWiiUBfres(object sender, EventArgs args)
@ -189,8 +189,6 @@ namespace FirstPlugin
drawables.Remove(skeleton);
}
List<AbstractGlDrawable> drawables = new List<AbstractGlDrawable>();
public void LoadEditors(object SelectedSection)
{
@ -214,27 +212,29 @@ namespace FirstPlugin
else
editor.LoadProperty(resFileU, OnPropertyChanged);
}
if (SelectedSection is FMDL)
else if (SelectedSection is FMDL)
{
if (((FMDL)SelectedSection).ModelU != null)
editor.LoadProperty(((FMDL)SelectedSection).ModelU, OnPropertyChanged);
else
editor.LoadProperty(((FMDL)SelectedSection).Model, OnPropertyChanged);
}
if (SelectedSection is FSHP)
else if (SelectedSection is FSHP)
{
if (((FSHP)SelectedSection).ShapeU != null)
editor.LoadProperty(((FSHP)SelectedSection).ShapeU, OnPropertyChanged);
else
editor.LoadProperty(((FSHP)SelectedSection).Shape, OnPropertyChanged);
}
if (SelectedSection is FMAT)
else if (SelectedSection is FMAT)
{
if (((FMAT)SelectedSection).MaterialU != null)
editor.LoadProperty(((FMAT)SelectedSection).MaterialU, OnPropertyChanged);
else
editor.LoadProperty(((FMAT)SelectedSection).MaterialU, OnPropertyChanged);
}
else
editor.LoadProperty(null, OnPropertyChanged);
}
else
{

View File

@ -0,0 +1,105 @@
using System;
using System.Collections.Generic;
using GL_EditorFramework.GL_Core;
using GL_EditorFramework.Interfaces;
using OpenTK.Graphics.OpenGL;
using OpenTK;
using System.Drawing;
using Switch_Toolbox.Library;
using GL_EditorFramework.EditorDrawables;
namespace FirstPlugin.Turbo.CourseMuuntStructs
{
public class RenderableConnectedMapPoints : AbstractGlDrawable
{
public Color LineColor = Color.Green;
public RenderableConnectedMapPoints(Color color)
{
LineColor = color;
}
private ShaderProgram defaultShaderProgram;
public List<RenderablePathPoint> Points = new List<RenderablePathPoint>();
public void AddRenderable(RenderablePathPoint point) {
Points.Add(point);
}
public override void Prepare(GL_ControlLegacy control)
{
}
public override void Prepare(GL_ControlModern control)
{
var defaultFrag = new FragmentShader(
@"#version 330
vec4 LineColor;
void main(){
gl_FragColor = LineColor;
}");
var defaultVert = new VertexShader(
@"#version 330
in vec4 position;
uniform mat4 mtxCam;
uniform mat4 mtxMdl;
void main(){
gl_Position = mtxCam * mtxMdl * vec4(position.xyz, 1);
}");
defaultShaderProgram = new ShaderProgram(defaultFrag, defaultVert);
}
public override void Draw(GL_ControlLegacy control, Pass pass)
{
int p = 0;
foreach (var point in Points)
{
if (!point.Visible)
continue;
if (p < Points.Count)
{
GL.LineWidth(2f);
GL.Color3(LineColor);
GL.Begin(PrimitiveType.Lines);
GL.Vertex3(point.Position);
GL.Vertex3(Points[p].Position);
GL.End();
}
p++;
}
}
public override void Draw(GL_ControlModern control, Pass pass)
{
control.CurrentShader = defaultShaderProgram;
defaultShaderProgram.SetVector4("LineColor", ColorUtility.ToVector4(LineColor));
int p = 0;
foreach (var point in Points)
{
if (!point.Visible)
continue;
if (p < Points.Count)
{
GL.LineWidth(2f);
GL.Color3(LineColor);
GL.Begin(PrimitiveType.Lines);
GL.Vertex3(point.Position);
GL.Vertex3(Points[p].Position);
GL.End();
}
p++;
}
}
}
}

View File

@ -5,6 +5,7 @@ using System.Text;
using System.Threading.Tasks;
using OpenTK;
using System.ComponentModel;
using Switch_Toolbox.Library;
namespace FirstPlugin.Turbo.CourseMuuntStructs
{
@ -173,6 +174,8 @@ namespace FirstPlugin.Turbo.CourseMuuntStructs
public List<int> MapObjIdList;
public List<string> MapObjResList;
public IFileFormat MapCamera;
public CourseMuuntScene(dynamic rootNode)
{
root = rootNode;

View File

@ -13,6 +13,8 @@ using OpenTK.Graphics.OpenGL;
using aampv1 = AampV1Library;
using aampv2 = AampV2Library;
using Switch_Toolbox.Library.Rendering;
using Switch_Toolbox.Library.IO;
using FirstPlugin.Turbo;
namespace FirstPlugin.Forms
{
@ -82,7 +84,34 @@ namespace FirstPlugin.Forms
//Add course model
if (File.Exists($"{CourseFolder}/course_model.szs"))
scene.AddRenderableBfres($"{CourseFolder}/course_model.szs");
//Add camera mini map parameters
if (File.Exists($"{CourseFolder}/course_mapcamera.bin"))
scene.MapCamera = STFileLoader.OpenFileFormat($"{CourseFolder}/course_mapcamera.bin");
if (scene.MapCamera != null)
{
var cam = (Course_MapCamera_bin)scene.MapCamera;
var pointConnection = new RenderableConnectedMapPoints(Color.Blue);
Vector4 PositionColor = new Vector4(1,0,0, 1);
Vector4 TargetColor = new Vector4(0, 1, 0, 1);
Vector3 CamTranslate = new Vector3(cam.cameraData.PositionX, cam.cameraData.PositionY, cam.cameraData.PositionZ);
Vector3 CamTargetTranslate = new Vector3(cam.cameraData.TargetX, cam.cameraData.TargetY, cam.cameraData.TargetZ);
var point1 = new RenderablePathPoint(PositionColor, CamTranslate, new Vector3(0), new Vector3(100), null);
var point2 = new RenderablePathPoint(TargetColor, CamTargetTranslate, new Vector3(0), new Vector3(100), null);
pointConnection.AddRenderable(point1);
pointConnection.AddRenderable(point2);
viewport.AddDrawable(pointConnection);
viewport.AddDrawable(point1);
viewport.AddDrawable(point2);
}
foreach (AAMP aamp in scene.ParameterArchives)
{
if (aamp.aampFileV1 != null)

View File

@ -210,8 +210,8 @@ namespace FirstPlugin
}
private void SwizzleNum_ValueChanged(object sender, EventArgs e) {
SelectedTexSettings.swizzle &= GX2.SwizzleMask;
SelectedTexSettings.swizzle |= (uint)SwizzleNum.Value << 8;
// SelectedTexSettings.swizzle &= GX2.SwizzleMask;
// SelectedTexSettings.swizzle |= (uint)SwizzleNum.Value << 8;
}

View File

@ -336,6 +336,7 @@
<Compile Include="GUI\Byaml\CourseMuunt\Base\BaseControlPoint.cs" />
<Compile Include="GUI\Byaml\CourseMuunt\Base\BaseObjPt.cs" />
<Compile Include="GUI\Byaml\CourseMuunt\Base\PointID.cs" />
<Compile Include="GUI\Byaml\CourseMuunt\Base\RenderableConnectedMapPoints.cs" />
<Compile Include="GUI\Byaml\CourseMuunt\CourseMuuntStructs.cs" />
<Compile Include="GUI\Byaml\CourseMuunt\IObject.cs" />
<Compile Include="GUI\Byaml\CourseMuunt\Paths\GravityPaths.cs" />

View File

@ -1 +1 @@
cc9e257c523db2c7ef86dbf7768c79a58b3e9716
7c84633eaa36420d4ca6a3cb60a7e5117cc8630b

View File

@ -3071,6 +3071,11 @@
Gets or sets flags specifying how a <see cref="T:Syroot.NintenTools.Bfres.Material"/> is rendered.
</summary>
</member>
<member name="P:Syroot.NintenTools.Bfres.Material.Visible">
<summary>
Gets or sets the visible flag to display the material.
</summary>
</member>
<member name="P:Syroot.NintenTools.Bfres.Material.TextureRefs">
<summary>
Gets or sets the list of <see cref="T:Syroot.NintenTools.Bfres.TextureRef"/> instances referencing the <see cref="T:Syroot.NintenTools.Bfres.Texture"/> instances