mirror of
https://github.com/aelurum/AssetStudio.git
synced 2025-05-27 22:00:23 -04:00
Try fix bug
This commit is contained in:
parent
9e5a06c107
commit
cb3cf2a5ea
2
AssetStudio/AssetStudioForm.Designer.cs
generated
2
AssetStudio/AssetStudioForm.Designer.cs
generated
@ -792,8 +792,10 @@
|
|||||||
this.glControl1.Size = new System.Drawing.Size(838, 632);
|
this.glControl1.Size = new System.Drawing.Size(838, 632);
|
||||||
this.glControl1.TabIndex = 4;
|
this.glControl1.TabIndex = 4;
|
||||||
this.glControl1.VSync = false;
|
this.glControl1.VSync = false;
|
||||||
|
this.glControl1.Visible = false;
|
||||||
this.glControl1.Paint += new System.Windows.Forms.PaintEventHandler(this.glControl1_Paint);
|
this.glControl1.Paint += new System.Windows.Forms.PaintEventHandler(this.glControl1_Paint);
|
||||||
this.glControl1.MouseWheel += new System.Windows.Forms.MouseEventHandler(this.glControl1_MouseWheel);
|
this.glControl1.MouseWheel += new System.Windows.Forms.MouseEventHandler(this.glControl1_MouseWheel);
|
||||||
|
this.glControl1.Load += new System.EventHandler(this.glControl1_Load);
|
||||||
//
|
//
|
||||||
// classPreviewPanel
|
// classPreviewPanel
|
||||||
//
|
//
|
||||||
|
@ -34,6 +34,7 @@ namespace AssetStudio
|
|||||||
private Bitmap imageTexture;
|
private Bitmap imageTexture;
|
||||||
|
|
||||||
#region OpenTK
|
#region OpenTK
|
||||||
|
private bool glControlLoaded;
|
||||||
private int pgmID, pgmColorID, pgmBlackID;
|
private int pgmID, pgmColorID, pgmBlackID;
|
||||||
private int attributeVertexPosition;
|
private int attributeVertexPosition;
|
||||||
private int attributeNormalDirection;
|
private int attributeNormalDirection;
|
||||||
@ -586,31 +587,6 @@ namespace AssetStudio
|
|||||||
resizeAssetListColumns();
|
resizeAssetListColumns();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void changeGLSize(Size size)
|
|
||||||
{
|
|
||||||
GL.Viewport(0, 0, size.Width, size.Height);
|
|
||||||
|
|
||||||
if (size.Width <= size.Height)
|
|
||||||
{
|
|
||||||
float k = 1.0f * size.Width / size.Height;
|
|
||||||
projMatrixData = Matrix4.CreateScale(1, k, 1);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
float k = 1.0f * size.Height / size.Width;
|
|
||||||
projMatrixData = Matrix4.CreateScale(k, 1, 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void preview_Resize(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
glControl1.Size = previewPanel.Size;
|
|
||||||
changeGLSize(glControl1.Size);
|
|
||||||
|
|
||||||
if (glControl1.Visible)
|
|
||||||
glControl1.Invalidate();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void listSearch_Enter(object sender, EventArgs e)
|
private void listSearch_Enter(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (listSearch.Text == " Filter ")
|
if (listSearch.Text == " Filter ")
|
||||||
@ -1546,7 +1522,6 @@ namespace AssetStudio
|
|||||||
uniformModelMatrix = GL.GetUniformLocation(pgmID, "modelMatrix");
|
uniformModelMatrix = GL.GetUniformLocation(pgmID, "modelMatrix");
|
||||||
uniformViewMatrix = GL.GetUniformLocation(pgmID, "viewMatrix");
|
uniformViewMatrix = GL.GetUniformLocation(pgmID, "viewMatrix");
|
||||||
uniformProjMatrix = GL.GetUniformLocation(pgmID, "projMatrix");
|
uniformProjMatrix = GL.GetUniformLocation(pgmID, "projMatrix");
|
||||||
glControl1.Visible = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void loadShader(string filename, ShaderType type, int program, out int address)
|
private void loadShader(string filename, ShaderType type, int program, out int address)
|
||||||
@ -1624,10 +1599,35 @@ namespace AssetStudio
|
|||||||
GL.BindVertexArray(0);
|
GL.BindVertexArray(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnLoad(EventArgs e)
|
private void changeGLSize(Size size)
|
||||||
|
{
|
||||||
|
GL.Viewport(0, 0, size.Width, size.Height);
|
||||||
|
|
||||||
|
if (size.Width <= size.Height)
|
||||||
|
{
|
||||||
|
float k = 1.0f * size.Width / size.Height;
|
||||||
|
projMatrixData = Matrix4.CreateScale(1, k, 1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
float k = 1.0f * size.Height / size.Width;
|
||||||
|
projMatrixData = Matrix4.CreateScale(k, 1, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void preview_Resize(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (glControlLoaded && glControl1.Visible)
|
||||||
|
{
|
||||||
|
changeGLSize(glControl1.Size);
|
||||||
|
glControl1.Invalidate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void glControl1_Load(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
base.OnLoad(e);
|
|
||||||
initOpenTK();
|
initOpenTK();
|
||||||
|
glControlLoaded = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void glControl1_Paint(object sender, PaintEventArgs e)
|
private void glControl1_Paint(object sender, PaintEventArgs e)
|
||||||
|
Loading…
Reference in New Issue
Block a user