From 5070c6b60ea88ba4c01ea5ab0da27f08168ada02 Mon Sep 17 00:00:00 2001 From: miku-666 <74728189+NessieHax@users.noreply.github.com> Date: Wed, 7 Feb 2024 21:21:05 +0100 Subject: [PATCH] SkinRenderer - Add TillingFactor property --- .../Skins-And-Textures/CustomSkinEditor.cs | 4 +- PCK-Studio/Rendering/SkinRenderer.cs | 64 ++++++++++--------- 2 files changed, 35 insertions(+), 33 deletions(-) diff --git a/PCK-Studio/Forms/Skins-And-Textures/CustomSkinEditor.cs b/PCK-Studio/Forms/Skins-And-Textures/CustomSkinEditor.cs index 0213d2c0..b4459f03 100644 --- a/PCK-Studio/Forms/Skins-And-Textures/CustomSkinEditor.cs +++ b/PCK-Studio/Forms/Skins-And-Textures/CustomSkinEditor.cs @@ -341,8 +341,8 @@ namespace PckStudio.Forms float penWidth = uvPictureBox.BackgroundImage.Width / renderer3D1.TextureSize.Width + uvPictureBox.BackgroundImage.Height / renderer3D1.TextureSize.Height / 2f; GraphicsPath graphicsPath = box.GetUVGraphicsPath( new System.Numerics.Vector2( - scale * (1f / renderer3D1.TextureSize.Width) * uvPictureBox.BackgroundImage.Width, - scale * (1f / renderer3D1.TextureSize.Height) * uvPictureBox.BackgroundImage.Height + scale * renderer3D1.TillingFactor.X * uvPictureBox.BackgroundImage.Width, + scale * renderer3D1.TillingFactor.Y * uvPictureBox.BackgroundImage.Height ) ); g.DrawPath(new Pen(Color.HotPink, penWidth), graphicsPath); diff --git a/PCK-Studio/Rendering/SkinRenderer.cs b/PCK-Studio/Rendering/SkinRenderer.cs index 4a4a6537..5c876b64 100644 --- a/PCK-Studio/Rendering/SkinRenderer.cs +++ b/PCK-Studio/Rendering/SkinRenderer.cs @@ -116,6 +116,7 @@ namespace PckStudio.Rendering } public Size TextureSize { get; private set; } = new Size(64, 64); + public Vector2 TillingFactor => new Vector2(1f / TextureSize.Width, 1f / TextureSize.Height); private const float OverlayScale = 1.12f; private bool IsMouseHidden @@ -465,7 +466,7 @@ namespace PckStudio.Rendering } framebuffer.Unbind(); } - } + private void UploadMeshData() { @@ -532,36 +533,6 @@ namespace PckStudio.Rendering Debug.Assert(error == ErrorCode.NoError, error.ToString()); } - protected override bool ProcessDialogKey(Keys keyData) - { - switch (keyData) - { - case Keys.Escape: - ReleaseMouse(); - var point = new Point(Parent.Location.X + Location.X, Parent.Location.Y + Location.Y); - contextMenuStrip1.Show(point); - return true; - case Keys.F3: - showWireFrame = !showWireFrame; - return true; - case Keys.R: - GlobalModelRotation = Vector2.Zero; - Camera.Distance = DefaultCameraDistance; - return true; - case Keys.A: - ReleaseMouse(); - { - using var animeditor = new ANIMEditor(ANIM); - if (animeditor.ShowDialog() == DialogResult.OK) - { - ANIM = animeditor.ResultAnim; - } - } - return true; - } - return base.ProcessDialogKey(keyData); - } - private void ReleaseMouse() { if (IsMouseHidden) @@ -619,6 +590,37 @@ namespace PckStudio.Rendering leftLegOverlay.SetEnabled(0, false); } + protected override bool ProcessDialogKey(Keys keyData) + { + switch (keyData) + { + case Keys.Escape: + ReleaseMouse(); + var point = new Point(Parent.Location.X + Location.X, Parent.Location.Y + Location.Y); + contextMenuStrip1.Show(point); + return true; + case Keys.F3: + showWireFrame = !showWireFrame; + return true; + case Keys.R: + GlobalModelRotation = Vector2.Zero; + Camera.Distance = DefaultCameraDistance; + Camera.FocalPoint = Vector3.Zero; + return true; + case Keys.A: + ReleaseMouse(); + { + using var animeditor = new ANIMEditor(ANIM); + if (animeditor.ShowDialog() == DialogResult.OK) + { + ANIM = animeditor.ResultAnim; + } + } + return true; + } + return base.ProcessDialogKey(keyData); + } + protected override void OnResize(EventArgs e) { base.OnResize(e);