private void UpdateVertexDescriptionList() { lstVertexDesc.Items.Clear(); foreach (clsProjectObject objItr in projectMain.ProjectObjects) { clsVertexDescription descItr = objItr as clsVertexDescription; if (descItr != null) { propsVertexDescriptionItem itmNew = new propsVertexDescriptionItem(descItr); lstVertexDesc.Items.Add(itmNew); if (Geometry.VertexDescription == descItr) { lstVertexDesc.SelectedItem = itmNew; } } } }
private void FrmGeometry_Load(object sender, EventArgs e) { glRender = new controlRender(); glRender.Name = Geometry.ToString(); glRender.Parent = panelRender; glRender.ForeColor = panelRender.ForeColor; glRender.BackColor = panelRender.BackColor; glRender.Dock = DockStyle.Fill; glRender.BringToFront(); glRender.BorderStyle = BorderStyle.FixedSingle; glRender.HandleCreated += glRender_HandleCreated; glRender.SizeChanged += glRender_Resize; glRender.Paint += glRender_Paint; containerMain = new clsCollapsePanel(panelCollapse); containerMain.CollapseStateChanged += containerMain_CollapseChange; containerMain.CollapseDistanceChanged += containerMain_CollapseDistanceChange; if (Geometry.VertexDescription == null) { clsVertexDescription newDesc = null; foreach (clsProjectObject objItr in projectMain.ProjectObjects) { clsVertexDescription descItr = objItr as clsVertexDescription; if (descItr != null) { newDesc = descItr; break; } } if (newDesc == null) { newDesc = new clsVertexDescription(); newDesc.Add(VertexAttribPointerType.Float, "Position", 3, 0); projectMain.ProjectObjects.Add(newDesc); } Geometry.VertexDescription = newDesc; } if (Geometry.Vertices == null) { clsVertexCollection newVertices = new clsVertexCollection(Geometry); newVertices.Count = 4; newVertices[0]["Position"] = new object[] { -1f, -1f, 0f }; newVertices[1]["Position"] = new object[] { 1f, -1f, 0f }; newVertices[2]["Position"] = new object[] { 1f, 1f, 0f }; newVertices[3]["Position"] = new object[] { -1f, 1f, 0f }; Geometry.Vertices = newVertices; } if (Geometry.Triangles == null) { clsTriangleCollection newTriangles = new clsTriangleCollection(Geometry); newTriangles.Count = 2; newTriangles[0].Items = new uint[] { 0, 1, 2 }; newTriangles[1].Items = new uint[] { 2, 3, 0 }; Geometry.Triangles = newTriangles; } Geometry.glUpdateBuffers(); propsGeometry.SelectedObject = new { Geometry.Vertices, Geometry.Triangles }; if (Geometry.VertexDescription != null) { Geometry.VertexDescription.Updated += Geometry_VertexDescription_Updated; } UpdateLists(); lstPositionAttr.SelectedIndex = Math.Min(lstPositionAttr.Items.Count - 1, 1); matxView.Row3 = new Vector4(0, 0, -2, 1); panelMain.Timer_IntervalUpdate += timerUpdateLists_EndInterval; tsRender = new infoFramePerformance(); glRender_Init(); ProjectDef.AllForms.Add(this); }
public propsVertexDescriptionItem(clsVertexDescription itm) { Description = itm; }