SkinRenderer - Add TillingFactor property

This commit is contained in:
miku-666
2024-02-07 21:21:05 +01:00
parent 8ec46a8148
commit 5070c6b60e
2 changed files with 35 additions and 33 deletions

View File

@@ -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);

View File

@@ -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);