diff --git a/.vs/Switch_Toolbox/v15/.suo b/.vs/Switch_Toolbox/v15/.suo
index b5bee4cf..c6bd98d8 100644
Binary files a/.vs/Switch_Toolbox/v15/.suo and b/.vs/Switch_Toolbox/v15/.suo differ
diff --git a/.vs/Switch_Toolbox/v15/Server/sqlite3/storage.ide b/.vs/Switch_Toolbox/v15/Server/sqlite3/storage.ide
index a1e539b2..f0e3c41b 100644
Binary files a/.vs/Switch_Toolbox/v15/Server/sqlite3/storage.ide and b/.vs/Switch_Toolbox/v15/Server/sqlite3/storage.ide differ
diff --git a/.vs/Switch_Toolbox/v15/Server/sqlite3/storage.ide-shm b/.vs/Switch_Toolbox/v15/Server/sqlite3/storage.ide-shm
index a386eb60..48bbf325 100644
Binary files a/.vs/Switch_Toolbox/v15/Server/sqlite3/storage.ide-shm and b/.vs/Switch_Toolbox/v15/Server/sqlite3/storage.ide-shm differ
diff --git a/.vs/Switch_Toolbox/v15/Server/sqlite3/storage.ide-wal b/.vs/Switch_Toolbox/v15/Server/sqlite3/storage.ide-wal
index 108f5ddb..644a8728 100644
Binary files a/.vs/Switch_Toolbox/v15/Server/sqlite3/storage.ide-wal and b/.vs/Switch_Toolbox/v15/Server/sqlite3/storage.ide-wal differ
diff --git a/Switch_FileFormatsMain/FileFormats/Collision/KCL.cs b/Switch_FileFormatsMain/FileFormats/Collision/KCL.cs
index b4a052c1..e4cf937b 100644
--- a/Switch_FileFormatsMain/FileFormats/Collision/KCL.cs
+++ b/Switch_FileFormatsMain/FileFormats/Collision/KCL.cs
@@ -680,9 +680,9 @@ namespace FirstPlugin
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);
+ Max.X = Math.Max(Max.X, vertex.pos.X);
+ Max.Y = Math.Max(Max.Y, vertex.pos.Y);
+ Max.Z = Math.Max(Max.Z, vertex.pos.Z);
}
}
diff --git a/Switch_FileFormatsMain/GL/BFRES_Render.cs b/Switch_FileFormatsMain/GL/BFRES_Render.cs
index a5528536..62b6f438 100644
--- a/Switch_FileFormatsMain/GL/BFRES_Render.cs
+++ b/Switch_FileFormatsMain/GL/BFRES_Render.cs
@@ -183,6 +183,15 @@ namespace FirstPlugin
private void DrawBoundingBoxes()
{
+ var boundings = GetSelectionBox();
+
+ DrawableBoundingBox.DrawBoundingBox(
+ new Vector3(boundings.minX, boundings.minY, boundings.minZ),
+ new Vector3(boundings.maxX, boundings.maxY, boundings.maxZ)
+ );
+
+ return;
+
foreach (FMDL mdl in models)
{
foreach (FSHP m in mdl.shapes)
@@ -1097,9 +1106,9 @@ namespace FirstPlugin
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);
+ Max.X = Math.Max(Max.X, vertex.pos.X);
+ Max.Y = Math.Max(Max.Y, vertex.pos.Y);
+ Max.Z = Math.Max(Max.Z, vertex.pos.Z);
}
}
}
diff --git a/Switch_FileFormatsMain/GUI/Byaml/CourseMuunt/TurboMunntEditor.cs b/Switch_FileFormatsMain/GUI/Byaml/CourseMuunt/TurboMunntEditor.cs
index f5db7df3..61b851ef 100644
--- a/Switch_FileFormatsMain/GUI/Byaml/CourseMuunt/TurboMunntEditor.cs
+++ b/Switch_FileFormatsMain/GUI/Byaml/CourseMuunt/TurboMunntEditor.cs
@@ -157,15 +157,18 @@ namespace FirstPlugin.Forms
{
probeLightingConfig = new ProbeLighting();
viewport.AddDrawable(probeLightingConfig);
- treeView1.Nodes.Add(new ProbeLightingWrapper(probeLightingConfig));
+ var probeRoot = new ProbeLightingWrapper(probeLightingConfig);
+ treeView1.Nodes.Add(probeRoot);
uint index = 0;
foreach (var val in aamp.RootNode.childParams)
{
var entry = new ProbeLighting.Entry();
- entry.Index = index;
+ entry.Index = index++;
probeLightingConfig.Entries.Add(entry);
+ probeRoot.Nodes.Add(new ProbeLightingEntryWrapper(entry));
+
foreach (var param in val.paramObjects)
{
switch (param.HashString)
@@ -189,6 +192,8 @@ namespace FirstPlugin.Forms
}
}
+ aamp.Save("DEBUG_PROBE.aamp");
+
foreach (var entry in probeLightingConfig.Entries)
{
Console.WriteLine(entry.Name);
@@ -251,12 +256,21 @@ namespace FirstPlugin.Forms
{
ProbeLighting.Grid grid = new ProbeLighting.Grid();
+ var mainBfres = scene.BfresObjects[0];
+ var boundings = mainBfres.BFRESRender.GetSelectionBox();
+
foreach (var entry in paramEntries)
{
- if (entry.HashString == "aabb_min_pos")
+ if (entry.HashString == "aabb_min_pos") {
grid.AABB_Max_Position = Utils.ToVec3((Syroot.Maths.Vector3F)entry.Value);
- if (entry.HashString == "aabb_max_pos")
+
+ entry.Value = new Syroot.Maths.Vector3F(boundings.minX, boundings.minY, boundings.minZ);
+ }
+ if (entry.HashString == "aabb_max_pos") {
grid.AABB_Min_Position = Utils.ToVec3((Syroot.Maths.Vector3F)entry.Value);
+
+ entry.Value = new Syroot.Maths.Vector3F(boundings.maxX, boundings.maxY, boundings.maxZ);
+ }
if (entry.HashString == "voxel_step_pos")
grid.Voxel_Step_Position = Utils.ToVec3((Syroot.Maths.Vector3F)entry.Value);
}
@@ -382,6 +396,23 @@ namespace FirstPlugin.Forms
{
stPropertyGrid1.LoadProperty(scene, OnPropertyChanged);
}
+ else if (node is ProbeLightingWrapper)
+ {
+ }
+ else if (node is ProbeLightingEntryWrapper)
+ {
+ var parent = (ProbeLightingWrapper)node.Parent;
+
+ foreach (var child in parent.Nodes)
+ {
+ ( (ProbeLightingEntryWrapper)child).entry.Grid.GridColor = new Vector3(9, 0, 0);
+ }
+
+ var probeEntry = (ProbeLightingEntryWrapper)node;
+ probeEntry.entry.Grid.GridColor = new Vector3(1,0,0);
+
+ stPropertyGrid1.LoadProperty(probeEntry.entry, OnPropertyChanged);
+ }
else if (node is PathCollectionNode)
{
foreach (var group in ((PathCollectionNode)node).Nodes)
@@ -441,6 +472,8 @@ namespace FirstPlugin.Forms
{
if (node is PathPointNode)
((PathPointNode)node).OnChecked(IsChecked);
+ if (node is ProbeLightingEntryWrapper)
+ ((ProbeLightingEntryWrapper)node).OnChecked(IsChecked);
}
}
}
diff --git a/Switch_FileFormatsMain/GUI/Byaml/CourseMuunt/Wrappers/ProbeLightingEntryWrapper.cs b/Switch_FileFormatsMain/GUI/Byaml/CourseMuunt/Wrappers/ProbeLightingEntryWrapper.cs
new file mode 100644
index 00000000..32ce0714
--- /dev/null
+++ b/Switch_FileFormatsMain/GUI/Byaml/CourseMuunt/Wrappers/ProbeLightingEntryWrapper.cs
@@ -0,0 +1,27 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Switch_Toolbox.Library;
+using Switch_Toolbox.Library.Rendering;
+
+namespace FirstPlugin.Turbo.CourseMuuntStructs
+{
+ public class ProbeLightingEntryWrapper : TreeNodeCustom
+ {
+ public ProbeLighting.Entry entry;
+
+ public void OnChecked(bool IsChecked)
+ {
+ entry.IsVisable = IsChecked;
+ }
+
+ public ProbeLightingEntryWrapper(ProbeLighting.Entry config) {
+ Text = config.Name;
+ Checked = true;
+
+ entry = config;
+ }
+ }
+}
diff --git a/Switch_FileFormatsMain/GUI/Byaml/CourseMuunt/Wrappers/ProbeLightingWrapper.cs b/Switch_FileFormatsMain/GUI/Byaml/CourseMuunt/Wrappers/ProbeLightingWrapper.cs
index f7bcf3c5..c7929626 100644
--- a/Switch_FileFormatsMain/GUI/Byaml/CourseMuunt/Wrappers/ProbeLightingWrapper.cs
+++ b/Switch_FileFormatsMain/GUI/Byaml/CourseMuunt/Wrappers/ProbeLightingWrapper.cs
@@ -10,11 +10,12 @@ namespace FirstPlugin.Turbo.CourseMuuntStructs
{
public class ProbeLightingWrapper : TreeNodeCustom
{
- ProbeLighting ProbeLightingConfig;
+ public ProbeLighting ProbeLightingConfig;
public ProbeLightingWrapper(ProbeLighting config) {
Text = "course.bglpbd (Probe Lighting)";
ProbeLightingConfig = config;
+ Checked = true;
}
}
}
diff --git a/Switch_FileFormatsMain/Switch_FileFormatsMain.csproj b/Switch_FileFormatsMain/Switch_FileFormatsMain.csproj
index c0ca5e54..f9fc6363 100644
--- a/Switch_FileFormatsMain/Switch_FileFormatsMain.csproj
+++ b/Switch_FileFormatsMain/Switch_FileFormatsMain.csproj
@@ -362,6 +362,7 @@
+
diff --git a/Switch_FileFormatsMain/obj/Release/AxInterop.WMPLib.dll b/Switch_FileFormatsMain/obj/Release/AxInterop.WMPLib.dll
index 2815fa82..87f0ddca 100644
Binary files a/Switch_FileFormatsMain/obj/Release/AxInterop.WMPLib.dll and b/Switch_FileFormatsMain/obj/Release/AxInterop.WMPLib.dll differ
diff --git a/Switch_FileFormatsMain/obj/Release/DesignTimeResolveAssemblyReferences.cache b/Switch_FileFormatsMain/obj/Release/DesignTimeResolveAssemblyReferences.cache
index 30e2f77b..e1f30420 100644
Binary files a/Switch_FileFormatsMain/obj/Release/DesignTimeResolveAssemblyReferences.cache and b/Switch_FileFormatsMain/obj/Release/DesignTimeResolveAssemblyReferences.cache differ
diff --git a/Switch_FileFormatsMain/obj/Release/FirstPlugin.Plg.dll b/Switch_FileFormatsMain/obj/Release/FirstPlugin.Plg.dll
index 1fef29fd..a2f30290 100644
Binary files a/Switch_FileFormatsMain/obj/Release/FirstPlugin.Plg.dll and b/Switch_FileFormatsMain/obj/Release/FirstPlugin.Plg.dll differ
diff --git a/Switch_FileFormatsMain/obj/Release/FirstPlugin.Plg.pdb b/Switch_FileFormatsMain/obj/Release/FirstPlugin.Plg.pdb
index 1b556cac..d3bfa0fd 100644
Binary files a/Switch_FileFormatsMain/obj/Release/FirstPlugin.Plg.pdb and b/Switch_FileFormatsMain/obj/Release/FirstPlugin.Plg.pdb differ
diff --git a/Switch_FileFormatsMain/obj/Release/Interop.WMPLib.dll b/Switch_FileFormatsMain/obj/Release/Interop.WMPLib.dll
index 6fa5bdf7..ec3e59fb 100644
Binary files a/Switch_FileFormatsMain/obj/Release/Interop.WMPLib.dll and b/Switch_FileFormatsMain/obj/Release/Interop.WMPLib.dll differ
diff --git a/Switch_FileFormatsMain/obj/Release/Switch_FileFormatsMain.csproj.CoreCompileInputs.cache b/Switch_FileFormatsMain/obj/Release/Switch_FileFormatsMain.csproj.CoreCompileInputs.cache
index 229f986f..83df05ba 100644
--- a/Switch_FileFormatsMain/obj/Release/Switch_FileFormatsMain.csproj.CoreCompileInputs.cache
+++ b/Switch_FileFormatsMain/obj/Release/Switch_FileFormatsMain.csproj.CoreCompileInputs.cache
@@ -1 +1 @@
-7798e93b603f2ef483cd6e7dc6584588e301ec40
+fb185deacd6b91f90d3d81f0920e25025a615d0b
diff --git a/Switch_FileFormatsMain/obj/Release/Switch_FileFormatsMain.csprojAssemblyReference.cache b/Switch_FileFormatsMain/obj/Release/Switch_FileFormatsMain.csprojAssemblyReference.cache
index 227f8dd9..bf4e79aa 100644
Binary files a/Switch_FileFormatsMain/obj/Release/Switch_FileFormatsMain.csprojAssemblyReference.cache and b/Switch_FileFormatsMain/obj/Release/Switch_FileFormatsMain.csprojAssemblyReference.cache differ
diff --git a/Switch_Toolbox_Library/Rendering/DrawableBoundingBox.cs b/Switch_Toolbox_Library/Rendering/DrawableBoundingBox.cs
new file mode 100644
index 00000000..17a0b3a3
--- /dev/null
+++ b/Switch_Toolbox_Library/Rendering/DrawableBoundingBox.cs
@@ -0,0 +1,57 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using OpenTK.Graphics.OpenGL;
+using OpenTK;
+
+namespace Switch_Toolbox.Library.Rendering
+{
+ public class DrawableBoundingBox
+ {
+ public static List GetBoundingVertices(Vector3 Min, Vector3 Max)
+ {
+ var vertices = new List();
+ vertices.Add(new Vector3(Min.X, Min.Y, Min.Z));
+ vertices.Add(new Vector3(Min.X, Min.Y, Max.Z));
+ vertices.Add(new Vector3(Min.X, Max.Y, Min.Z));
+ vertices.Add(new Vector3(Min.X, Max.Y, Max.Z));
+ vertices.Add(new Vector3(Max.X, Min.Y, Min.Z));
+ vertices.Add(new Vector3(Max.X, Min.Y, Max.Z));
+ vertices.Add(new Vector3(Max.X, Max.Y, Min.Z));
+ vertices.Add(new Vector3(Max.X, Max.Y, Max.Z));
+ return vertices;
+ }
+
+ public static void DrawBoundingBox(Vector3 Min, Vector3 Max)
+ {
+ var vertices = GetBoundingVertices(Min, Max);
+
+ GL.Begin(PrimitiveType.LineLoop);
+ GL.Vertex3(vertices[0]);
+ GL.Vertex3(vertices[1]);
+ GL.Vertex3(vertices[3]);
+ GL.Vertex3(vertices[2]);
+ GL.End();
+
+ GL.Begin(PrimitiveType.LineLoop);
+ GL.Vertex3(vertices[4]);
+ GL.Vertex3(vertices[5]);
+ GL.Vertex3(vertices[7]);
+ GL.Vertex3(vertices[6]);
+ GL.End();
+
+ GL.Begin(PrimitiveType.Lines);
+ GL.Vertex3(vertices[0]);
+ GL.Vertex3(vertices[4]);
+ GL.Vertex3(vertices[1]);
+ GL.Vertex3(vertices[5]);
+ GL.Vertex3(vertices[3]);
+ GL.Vertex3(vertices[7]);
+ GL.Vertex3(vertices[2]);
+ GL.Vertex3(vertices[6]);
+ GL.End();
+ }
+ }
+}
diff --git a/Switch_Toolbox_Library/Rendering/ProbeLighting.cs b/Switch_Toolbox_Library/Rendering/ProbeLighting.cs
index f81fcf5f..d65c5a82 100644
--- a/Switch_Toolbox_Library/Rendering/ProbeLighting.cs
+++ b/Switch_Toolbox_Library/Rendering/ProbeLighting.cs
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using OpenTK;
+using OpenTK.Graphics.OpenGL;
using System.Text;
using System.Threading.Tasks;
using GL_EditorFramework.GL_Core;
@@ -16,6 +17,8 @@ namespace Switch_Toolbox.Library.Rendering
public class Entry
{
+ public bool IsVisable = true;
+
public string Name { get { return $"b_{Index}"; } }
public uint Index = 0;
@@ -29,24 +32,254 @@ namespace Switch_Toolbox.Library.Rendering
public uint MaxIndexNum;
public uint[] IndexBuffer = new uint[0];
+
+ public ushort[] GetUint16BufferIndices()
+ {
+ if (!IsUint16Buffer())
+ throw new Exception("Buffer not a ushort buffer!");
+
+ List Indices = new List();
+
+ //Read the buffer data back as ushort
+ for (int i = 0; i < IndexBuffer.Length; i++)
+ {
+ byte[] bytes = BitConverter.GetBytes(IndexBuffer[i]);
+ Indices.Add(BitConverter.ToUInt16(bytes, 0));
+ Indices.Add(BitConverter.ToUInt16(bytes, 2));
+ }
+
+ return Indices.ToArray();
+ }
+
+ public bool IsUint16Buffer()
+ {
+ if (IndexBuffer.Length / 2 == UsedIndexNum)
+ return true;
+ else return false;
+ }
+
+ public bool IsUint32Buffer()
+ {
+ if (IndexBuffer.Length == UsedIndexNum)
+ return true;
+ else return false;
+ }
+
//Data Buffer
public uint DataType = 0;
public uint UsedShDataNum;
public uint MaxShDataNum;
public uint PerProbeNum = 27;
public float[] DataBuffer = new float[0];
+
+ public bool IsHalfFloatBuffer()
+ {
+ if ((DataBuffer.Length * PerProbeNum) / 2 == UsedShDataNum)
+ return true;
+ else return false;
+ }
+
+ public bool IsFloatBuffer()
+ {
+ if ((DataBuffer.Length * PerProbeNum) == UsedShDataNum)
+ return true;
+ else return false;
+ }
+
+ //Color data in the data buffer
+ public class ShereHermonic
+ {
+ //Usually 27
+ public Vector3[] Coefficents;
+
+ public ShereHermonic(int PerProbeNum) {
+ Coefficents = new Vector3[PerProbeNum];
+ }
+ }
}
public class Grid
{
+ public Vector3 GridColor;
+
public Vector3 AABB_Max_Position;
public Vector3 AABB_Min_Position;
public Vector3 Voxel_Step_Position;
}
+ protected static ShaderProgram ProbeSHShaderProgram;
+
+ int vbo_position;
+
+ public void Destroy()
+ {
+ bool buffersWereInitialized = vbo_position != 0;
+ if (!buffersWereInitialized)
+ return;
+
+ GL.DeleteBuffer(vbo_position);
+ }
+
+ public List GetProbeVertices(int index)
+ {
+ var entry = Entries[index];
+
+ var vertices = new List();
+
+ Vector3 Max = entry.Grid.AABB_Max_Position;
+ Vector3 Min = entry.Grid.AABB_Min_Position;
+ Vector3 Step = entry.Grid.AABB_Min_Position;
+
+ float GridWidth = Min.X + Max.X;
+ float GirdHeight = Min.Y + Max.Y;
+
+ /* //Draw Z plane
+ for (int x = 0; x < GridWidth; x++)
+ {
+ for (int y = 0; y < GirdHeight; y++)
+ {
+ Vector3 position = new Vector3(Min.X + (x / Step.X) * (Max.X - Min.X),
+ Min.Y + (y / Step.Y) * (Max.Y - Min.Y),
+ Max.Z);
+
+ vertices.Add(position);
+ }
+ }*/
+
+ return vertices;
+ }
+
+ public List GetBoundingVertices(int index)
+ {
+ var entry = Entries[index];
+
+ var vertices = new List();
+
+ Vector3 Max = entry.Grid.AABB_Max_Position;
+ Vector3 Min = entry.Grid.AABB_Min_Position;
+
+ vertices.Add(new Vector3(Min.X, Min.Y, Min.Z));
+ vertices.Add(new Vector3(Min.X, Min.Y, Max.Z));
+ vertices.Add(new Vector3(Min.X, Max.Y, Min.Z));
+ vertices.Add(new Vector3(Min.X, Max.Y, Max.Z));
+ vertices.Add(new Vector3(Max.X, Min.Y, Min.Z));
+ vertices.Add(new Vector3(Max.X, Min.Y, Max.Z));
+ vertices.Add(new Vector3(Max.X, Max.Y, Min.Z));
+ vertices.Add(new Vector3(Max.X, Max.Y, Max.Z));
+
+ return vertices;
+ }
+
+ public static int CellAmount;
+ public static int CellSize;
+
+ int CurrentIndex = 0;
+
+ Vector3[] Vertices
+ {
+ get
+ {
+ return GetProbeVertices(CurrentIndex).ToArray();
+ }
+ }
+
+ public void UpdateVertexData()
+ {
+ Vector3[] vertices = Vertices;
+
+ GL.GenBuffers(1, out vbo_position);
+ GL.BindBuffer(BufferTarget.ArrayBuffer, vbo_position);
+ GL.BufferData(BufferTarget.ArrayBuffer,
+ new IntPtr(vertices.Length * Vector3.SizeInBytes),
+ vertices, BufferUsageHint.StaticDraw);
+ }
+
public override void Draw(GL_ControlModern control, Pass pass)
{
+ if (pass == Pass.TRANSPARENT)
+ return;
+ bool buffersWereInitialized = vbo_position != 0;
+ if (!buffersWereInitialized)
+ UpdateVertexData();
+
+ if (!Runtime.OpenTKInitialized)
+ return;
+
+ control.CurrentShader = ProbeSHShaderProgram;
+ control.UpdateModelMatrix(Matrix4.Identity);
+
+ Matrix4 previewScale = Utils.TransformValues(Vector3.Zero, Vector3.Zero, Runtime.previewScale);
+
+ ProbeSHShaderProgram.SetMatrix4x4("previewScale", ref previewScale);
+
+ foreach (var entry in Entries)
+ {
+ if (!entry.IsVisable)
+ continue;
+
+ Vector3[] vertices = GetBoundingVertices((int)entry.Index).ToArray();
+
+ Vector3 Max = entry.Grid.AABB_Max_Position;
+ Vector3 Min = entry.Grid.AABB_Min_Position;
+ Vector3 Step = entry.Grid.Voxel_Step_Position;
+
+ float gridHeight = Min.Y + Max.Y;
+ float gridWidth = Min.X + Max.X;
+ float gridDepth = Min.Z + Max.Z;
+
+
+ //Draw bounding box
+ GL.Color3(entry.Grid.GridColor);
+
+ GL.Begin(PrimitiveType.LineLoop);
+ GL.Vertex3(vertices[0]);
+ GL.Vertex3(vertices[1]);
+ GL.Vertex3(vertices[3]);
+ GL.Vertex3(vertices[2]);
+ GL.End();
+
+ GL.Begin(PrimitiveType.LineLoop);
+ GL.Vertex3(vertices[4]);
+ GL.Vertex3(vertices[5]);
+ GL.Vertex3(vertices[7]);
+ GL.Vertex3(vertices[6]);
+ GL.End();
+
+ GL.Begin(PrimitiveType.Lines);
+ GL.Vertex3(vertices[0]);
+ GL.Vertex3(vertices[4]);
+ GL.Vertex3(vertices[1]);
+ GL.Vertex3(vertices[5]);
+ GL.Vertex3(vertices[3]);
+ GL.Vertex3(vertices[7]);
+ GL.Vertex3(vertices[2]);
+ GL.Vertex3(vertices[6]);
+ GL.End();
+
+ ProbeSHShaderProgram.EnableVertexAttributes();
+ Draw(ProbeSHShaderProgram);
+ ProbeSHShaderProgram.DisableVertexAttributes();
+ }
+
+ GL.UseProgram(0);
+ }
+
+ private void Attributes(ShaderProgram shader)
+ {
+ GL.BindBuffer(BufferTarget.ArrayBuffer, vbo_position);
+ GL.VertexAttribPointer(shader.GetAttribute("vPosition"), 3, VertexAttribPointerType.Float, false, 12, 0);
+ }
+ private void Uniforms(ShaderProgram shader)
+ {
+ shader.SetVector3("gridColor", ColorUtility.ToVector3(System.Drawing.Color.Black));
+ }
+ private void Draw(ShaderProgram shader)
+ {
+ Uniforms(shader);
+ Attributes(shader);
+
+ GL.DrawArrays(PrimitiveType.Points, 0, Vertices.Length);
}
public override void Draw(GL_ControlLegacy control, Pass pass)
@@ -56,7 +289,24 @@ namespace Switch_Toolbox.Library.Rendering
public override void Prepare(GL_ControlModern control)
{
+ var Frag = new FragmentShader(
+ @"#version 330
+ uniform vec3 gridColor;
+ void main(){
+ gl_FragColor = vec4(gridColor, 1);
+ }");
+ var Vert = new VertexShader(
+ @"#version 330
+ in vec3 vPosition;
+ uniform mat4 mtxMdl;
+ uniform mat4 mtxCam;
+
+ void main(){
+ gl_Position = mtxMdl * mtxCam * vec4(vPosition.xyz, 1);
+ }");
+
+ ProbeSHShaderProgram = new ShaderProgram(Frag, Vert);
}
public override void Prepare(GL_ControlLegacy control)
diff --git a/Switch_Toolbox_Library/Switch_Toolbox_Library.csproj b/Switch_Toolbox_Library/Switch_Toolbox_Library.csproj
index 5f7ecd9b..3e58673f 100644
--- a/Switch_Toolbox_Library/Switch_Toolbox_Library.csproj
+++ b/Switch_Toolbox_Library/Switch_Toolbox_Library.csproj
@@ -570,6 +570,7 @@
+
diff --git a/Switch_Toolbox_Library/Swizzling/GX2.cs b/Switch_Toolbox_Library/Swizzling/GX2.cs
index 4b6b814a..82c4f541 100644
--- a/Switch_Toolbox_Library/Swizzling/GX2.cs
+++ b/Switch_Toolbox_Library/Swizzling/GX2.cs
@@ -754,7 +754,7 @@ namespace Switch_Toolbox.Library
return swizzleSurf(width, height, depth, format_, tileMode, swizzle_, pitch, bpp, data, depthLevel, 1);
}
- private static byte[] swizzleSurf(uint width, uint height,uint depth, uint format, uint tileMode, uint swizzle_,
+ private static byte[] swizzleSurf(uint width, uint height, uint depth, uint format, uint tileMode, uint swizzle_,
uint pitch, uint bitsPerPixel, byte[] data, int depthLevel, int swizzle)
{
uint bytesPerPixel = bitsPerPixel / 8;
@@ -1910,9 +1910,9 @@ namespace Switch_Toolbox.Library
tileMode,
padDims,
(flags.value >> 4) & 1,
- (flags.value >> 7) & 1,
pitchAlign,
- heightAlign);
+ heightAlign,
+ microTileThickness);
expPitch = padDimens.Item1;
expHeight = padDimens.Item2;
@@ -1995,9 +1995,9 @@ namespace Switch_Toolbox.Library
tileMode,
padDims,
(flags.value >> 4) & 1,
- (flags.value >> 7) & 1,
pitchAlign,
- heightAlign);
+ heightAlign,
+ microTileThickness);
expPitch = padDimens.Item1;
expHeight = padDimens.Item2;
@@ -2485,4 +2485,4 @@ namespace Switch_Toolbox.Library
return pSurfOut;
}
}
-}
+}
\ No newline at end of file