remove old RenderSettingForm controls

This commit is contained in:
Random
2021-03-16 10:22:45 +01:00
parent de83810f90
commit d79ffeaf97
8 changed files with 60 additions and 195 deletions
+19 -4
View File
@@ -22,11 +22,22 @@ namespace F3DZEX.Render
{
public class Config
{
public event EventHandler OnGridScaleChanged;
private float _gridScale = 5000;
public bool RenderTextures { get; set; } = true;
public float GridScale { get; set; } = 5000;
public float GridScale {
get => _gridScale;
set {
_gridScale = value;
OnGridScaleChanged?.Invoke(this, new EventArgs());
}
}
public bool ShowGrid { get; set; } = true;
public bool ShowAxis { get; set; } = true;
public bool DiffuseLight { get; set; } = false;
//public bool DiffuseLight { get; set; } = false;
}
@@ -148,6 +159,12 @@ namespace F3DZEX.Render
_rdpVtxDrawer.SetData(_vtxBuffer, BufferUsageHint.DynamicDraw);
CurrentConfig.OnGridScaleChanged += (o, e) =>
{
float[] vertices = RenderHelper.GenerateGridVertices(CurrentConfig.GridScale, 6, false);
_gridDrawer.SetSubData(vertices, 0);
};
CheckGLErros();
_initialized = true;
}
@@ -295,7 +312,6 @@ namespace F3DZEX.Render
static int TexDecodeCount = 0;
private void DecodeTexIfRequired()
{
@@ -456,7 +472,6 @@ namespace F3DZEX.Render
var settile = info.Convert<Command.GSetTile>();
_mirrorV = settile.cmT.HasFlag(Enums.ClampMirrorFlag.G_TX_MIRROR);
_mirrorH = settile.cmS.HasFlag(Enums.ClampMirrorFlag.G_TX_MIRROR);
@@ -37,5 +37,9 @@ namespace F3DZEX.Render
{
_attrs.SetData(data, data.Length * sizeof(float), hint);
}
public void SetSubData(float[] data, int off = 0)
{
_attrs.SetSubData(data, off, data.Length * sizeof(float));
}
}
}
+11 -118
View File
@@ -29,119 +29,24 @@
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(RenderSettingsForm));
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.label3 = new System.Windows.Forms.Label();
this.value_gridScale = new System.Windows.Forms.NumericUpDown();
this.checkBox_showAxis = new System.Windows.Forms.CheckBox();
this.checkBox_showGrid = new System.Windows.Forms.CheckBox();
this.checkBox_renderTextures = new System.Windows.Forms.CheckBox();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.groupBox1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.value_gridScale)).BeginInit();
this.groupBox2.SuspendLayout();
this.propertyGrid1 = new System.Windows.Forms.PropertyGrid();
this.SuspendLayout();
//
// groupBox1
// propertyGrid1
//
this.groupBox1.Controls.Add(this.label3);
this.groupBox1.Controls.Add(this.value_gridScale);
this.groupBox1.Controls.Add(this.checkBox_showAxis);
this.groupBox1.Controls.Add(this.checkBox_showGrid);
this.groupBox1.Location = new System.Drawing.Point(12, 12);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(174, 85);
this.groupBox1.TabIndex = 6;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Render Control Settings";
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(6, 56);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(56, 13);
this.label3.TabIndex = 3;
this.label3.Text = "Grid Scale";
//
// value_gridScale
//
this.value_gridScale.Location = new System.Drawing.Point(65, 53);
this.value_gridScale.Maximum = new decimal(new int[] {
1000000,
0,
0,
0});
this.value_gridScale.Minimum = new decimal(new int[] {
1,
0,
0,
0});
this.value_gridScale.Name = "value_gridScale";
this.value_gridScale.Size = new System.Drawing.Size(103, 20);
this.value_gridScale.TabIndex = 2;
this.value_gridScale.Value = new decimal(new int[] {
5000,
0,
0,
0});
this.value_gridScale.ValueChanged += new System.EventHandler(this.UpdateSettings);
//
// checkBox_showAxis
//
this.checkBox_showAxis.AutoSize = true;
this.checkBox_showAxis.Checked = true;
this.checkBox_showAxis.CheckState = System.Windows.Forms.CheckState.Checked;
this.checkBox_showAxis.Location = new System.Drawing.Point(9, 17);
this.checkBox_showAxis.Name = "checkBox_showAxis";
this.checkBox_showAxis.Size = new System.Drawing.Size(75, 17);
this.checkBox_showAxis.TabIndex = 1;
this.checkBox_showAxis.Text = "Show Axis";
this.checkBox_showAxis.UseVisualStyleBackColor = true;
this.checkBox_showAxis.CheckedChanged += new System.EventHandler(this.UpdateSettings);
//
// checkBox_showGrid
//
this.checkBox_showGrid.AutoSize = true;
this.checkBox_showGrid.Checked = true;
this.checkBox_showGrid.CheckState = System.Windows.Forms.CheckState.Checked;
this.checkBox_showGrid.Location = new System.Drawing.Point(9, 35);
this.checkBox_showGrid.Name = "checkBox_showGrid";
this.checkBox_showGrid.Size = new System.Drawing.Size(75, 17);
this.checkBox_showGrid.TabIndex = 0;
this.checkBox_showGrid.Text = "Show Grid";
this.checkBox_showGrid.UseVisualStyleBackColor = true;
this.checkBox_showGrid.CheckedChanged += new System.EventHandler(this.UpdateSettings);
//
// checkBox_renderTextures
//
this.checkBox_renderTextures.AutoSize = true;
this.checkBox_renderTextures.Checked = true;
this.checkBox_renderTextures.CheckState = System.Windows.Forms.CheckState.Checked;
this.checkBox_renderTextures.Location = new System.Drawing.Point(23, 30);
this.checkBox_renderTextures.Name = "checkBox_renderTextures";
this.checkBox_renderTextures.Size = new System.Drawing.Size(105, 17);
this.checkBox_renderTextures.TabIndex = 4;
this.checkBox_renderTextures.Text = "Render Textures";
this.checkBox_renderTextures.UseVisualStyleBackColor = true;
this.checkBox_renderTextures.CheckedChanged += new System.EventHandler(this.UpdateSettings);
//
// groupBox2
//
this.groupBox2.Controls.Add(this.checkBox_renderTextures);
this.groupBox2.Location = new System.Drawing.Point(12, 103);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(174, 61);
this.groupBox2.TabIndex = 7;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "Renderer Settings";
this.propertyGrid1.HelpVisible = false;
this.propertyGrid1.Location = new System.Drawing.Point(3, 9);
this.propertyGrid1.Name = "propertyGrid1";
this.propertyGrid1.Size = new System.Drawing.Size(249, 174);
this.propertyGrid1.TabIndex = 8;
this.propertyGrid1.PropertyValueChanged += new System.Windows.Forms.PropertyValueChangedEventHandler(this.propertyGrid1_PropertyValueChanged);
//
// RenderSettingsForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(198, 174);
this.Controls.Add(this.groupBox2);
this.Controls.Add(this.groupBox1);
this.ClientSize = new System.Drawing.Size(257, 187);
this.Controls.Add(this.propertyGrid1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MaximizeBox = false;
@@ -149,23 +54,11 @@
this.Name = "RenderSettingsForm";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Render Settings";
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.value_gridScale)).EndInit();
this.groupBox2.ResumeLayout(false);
this.groupBox2.PerformLayout();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.CheckBox checkBox_renderTextures;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.NumericUpDown value_gridScale;
private System.Windows.Forms.CheckBox checkBox_showAxis;
private System.Windows.Forms.CheckBox checkBox_showGrid;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.PropertyGrid propertyGrid1;
}
}
+8 -10
View File
@@ -18,24 +18,22 @@ namespace Z64.Forms
Renderer.Config _rendererCfg;
public RenderSettingsForm(Renderer.Config rendererCfg)
public RenderSettingsForm(Renderer.Config cfg)
{
InitializeComponent();
_rendererCfg = rendererCfg;
checkBox_renderTextures.Checked = _rendererCfg.RenderTextures;
value_gridScale.Value = (decimal)_rendererCfg.GridScale;
checkBox_showAxis.Checked = _rendererCfg.ShowAxis;
checkBox_showGrid.Checked = _rendererCfg.ShowGrid;
_rendererCfg = cfg;
propertyGrid1.SelectedObject = _rendererCfg;
}
private void UpdateSettings(object sender, EventArgs e)
{
_rendererCfg.RenderTextures = checkBox_renderTextures.Checked;
_rendererCfg.GridScale = (float)value_gridScale.Value;
_rendererCfg.ShowAxis = checkBox_showAxis.Checked;
_rendererCfg.ShowGrid = checkBox_showGrid.Checked;
SettingsChanged?.Invoke(this, EventArgs.Empty);
}
private void propertyGrid1_PropertyValueChanged(object s, PropertyValueChangedEventArgs e)
{
SettingsChanged?.Invoke(this, EventArgs.Empty);
}
}
+3 -63
View File
@@ -1,64 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<root>
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
@@ -117,8 +57,8 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<assembly alias="System.Drawing.Common" name="System.Drawing.Common, Version=4.0.2.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51" />
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing.Common" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
AAABAAUAEBAAAAEAIABoBAAAVgAAABgYAAABACAAiAkAAL4EAAAgIAAAAQAgAKgQAABGDgAAMDAAAAEA
IACoJQAA7h4AAGBgAAABACAAqJQAAJZEAAAoAAAAEAAAACAAAAABACAAAAAAAAAEAAAAAAAAAAAAAAAA
+1
View File
@@ -137,6 +137,7 @@ namespace Z64.Forms
this.toolStripSegmentsBtn.Name = "toolStripSegmentsBtn";
this.toolStripSegmentsBtn.Size = new System.Drawing.Size(63, 22);
this.toolStripSegmentsBtn.Text = "Segments";
this.toolStripSegmentsBtn.Click += ToolStripSegmentsBtn_Click;
//
// toolStrip2
//
+11
View File
@@ -2,6 +2,7 @@
in vec2 v_VtxTexCoords;
in vec4 v_VtxColor;
flat in int v_VtxId;
uniform vec3 u_DirLight;
uniform sampler2D u_Tex;
@@ -22,4 +23,14 @@ void main()
/* highlight */
gl_FragColor = mix(gl_FragColor, u_HighlightColor, vec4(u_HighlightColor.a));
//gl_FragColor = vec4(1, 0, 0, 1);
/* Debug Vertex ID */
/*
if (v_VtxId % 3 == 0)
gl_FragColor = vec4(1, 0, 0, 1);
else if (v_VtxId % 3 == 1)
gl_FragColor = vec4(0, 1, 0, 1);
else
gl_FragColor = vec4(0, 0, 1, 1);
*/
}
+3
View File
@@ -12,6 +12,7 @@ uniform sampler2D u_Tex;
out vec2 v_VtxTexCoords;
out vec4 v_VtxColor;
flat out int v_VtxId;
float S105ToFloat(int fp)
{
@@ -26,6 +27,8 @@ vec2 decodeTexCoords(sampler2D tex, ivec2 coords)
void main()
{
v_VtxId = gl_VertexID;
/* The vertices coordinates are multiplied by the model view matrix during the G_VTX command processing */
gl_Position = u_Projection * u_View /* u_Model*/ * vec4(pos, 1);
v_VtxTexCoords = decodeTexCoords(u_Tex, texCoords);