private void mapViewer1_RenderCollision(bool Picking) { if (KCL == null) { return; } int i = 0; foreach (var p in KCL.Planes) { //Vector3 PositionA, PositionB, PositionC, Normal; Triangle t = KCL.GetTriangle(p); Color c = MKDS.KCL.GetColor(p.CollisionType); if (Picking && c.A != 0) { c = Color.FromArgb(i + 1 | 0xFF << 24); } Gl.glColor4f(c.R / 255f, c.G / 255f, c.B / 255f, c.A / 255f); Gl.glBegin(Gl.GL_TRIANGLES); //Gl.glNormal3f(t.Normal.X, t.Normal.Y, t.Normal.Z); Gl.glVertex3f(t.PointA.X, t.PointA.Z, t.PointA.Y); Gl.glVertex3f(t.PointB.X, t.PointB.Z, t.PointB.Y); Gl.glVertex3f(t.PointC.X, t.PointC.Z, t.PointC.Y); Gl.glEnd(); i++; } }
public void RenderKCL(bool picking = false) { int i = 0; foreach (var p in KCL.Planes) { //Vector3 PositionA, PositionB, PositionC, Normal; Triangle t = KCL.GetTriangle(p); Color c = MKDS.KCL.GetColor(p.CollisionType); if (picking && c.A != 0) { c = Color.FromArgb(i + 1 | 0xFF << 24); } Gl.glColor4f(c.R / 255f, c.G / 255f, c.B / 255f, c.A / 255f); Gl.glBegin(Gl.GL_TRIANGLES); //Gl.glNormal3f(t.Normal.X, t.Normal.Y, t.Normal.Z); Gl.glVertex3f(t.PointA.X, t.PointA.Z, t.PointA.Y); Gl.glVertex3f(t.PointB.X, t.PointB.Z, t.PointB.Y); Gl.glVertex3f(t.PointC.X, t.PointC.Z, t.PointC.Y); Gl.glEnd(); i++; } }
public void RenderKCL(bool picking = false) { int i = 0; foreach (var p in KCL.Planes) { //Vector3 PositionA, PositionB, PositionC, Normal; Triangle t = KCL.GetTriangle(p); Color c = Color.Gray; //MKDS.KCL.GetColor(p.CollisionType); if (picking && c.A != 0) { c = Color.FromArgb(i + 1 | 0xFF << 24); } GL.Color4(c.R / 255f, c.G / 255f, c.B / 255f, c.A / 255f); GL.Begin(PrimitiveType.Triangles); //GL.Normal3(t.Normal.X, t.Normal.Y, t.Normal.Z); GL.Vertex3(t.PointA.X, t.PointA.Z, t.PointA.Y); GL.Vertex3(t.PointB.X, t.PointB.Z, t.PointB.Y); GL.Vertex3(t.PointC.X, t.PointC.Z, t.PointC.Y); GL.End(); i++; } }
private void toolStripButton2_Click(object sender, EventArgs e) { Gl.glMatrixMode(5889); Gl.glLoadIdentity(); Gl.glViewport(0, 0, this.simpleOpenGlControl1.Width, this.simpleOpenGlControl1.Height); float num1 = float.MaxValue; float num2 = float.MaxValue; float num3 = float.MinValue; float num4 = float.MinValue; Vector3 PositionA; Vector3 PositionB; Vector3 PositionC; for (int PlaneIdx = 0; PlaneIdx < this.k.Planes.Length; ++PlaneIdx) { if (((int)this.k.Planes[PlaneIdx].Type >> 8 & 31) == 0 || ((int)this.k.Planes[PlaneIdx].Type >> 8 & 31) == 1 || (((int)this.k.Planes[PlaneIdx].Type >> 8 & 31) == 3 || ((int)this.k.Planes[PlaneIdx].Type >> 8 & 31) == 7) || (((int)this.k.Planes[PlaneIdx].Type >> 8 & 31) == 8 || ((int)this.k.Planes[PlaneIdx].Type >> 8 & 31) == 18) || ((int)this.k.Planes[PlaneIdx].Type >> 8 & 31) == 19) { KCL.GetTriangle(this.k, PlaneIdx, out PositionA, out PositionB, out PositionC); if ((double)PositionA.X < (double)num1 && (double)PositionA.X > (double)short.MinValue) { num1 = PositionA.X; } if ((double)PositionA.X > (double)num3 && (double)PositionA.X < (double)short.MaxValue) { num3 = PositionA.X; } if ((double)PositionB.X < (double)num1 && (double)PositionB.X > (double)short.MinValue) { num1 = PositionB.X; } if ((double)PositionB.X > (double)num3 && (double)PositionB.X < (double)short.MaxValue) { num3 = PositionB.X; } if ((double)PositionC.X < (double)num1 && (double)PositionC.X > (double)short.MinValue) { num1 = PositionC.X; } if ((double)PositionC.X > (double)num3 && (double)PositionC.X < (double)short.MaxValue) { num3 = PositionC.X; } if ((double)PositionA.Z < (double)num2 && (double)PositionA.Z > (double)short.MinValue) { num2 = PositionA.Z; } if ((double)PositionA.Z > (double)num4 && (double)PositionA.Z < (double)short.MaxValue) { num4 = PositionA.Z; } if ((double)PositionB.Z < (double)num2 && (double)PositionB.Z > (double)short.MinValue) { num2 = PositionB.Z; } if ((double)PositionB.Z > (double)num4 && (double)PositionB.Z < (double)short.MaxValue) { num4 = PositionB.Z; } if ((double)PositionC.Z < (double)num2 && (double)PositionC.Z > (double)short.MinValue) { num2 = PositionC.Z; } if ((double)PositionC.Z > (double)num4 && (double)PositionC.Z < (double)short.MaxValue) { num4 = PositionC.Z; } } } float num5 = (float)(int)num1; float num6 = (float)(int)num2; float num7 = (float)(int)num3; float num8 = (float)(int)num4; float val1_1 = num5 - 512f; float val2_1 = num6 - 512f; float val1_2 = num7 + 512f; float val2_2 = num8 + 512f; this.textBox1.Text = ((int)((double)Math.Min(val1_1, val2_1) * 1.33333337306976)).ToString(); this.textBox3.Text = ((int)((double)Math.Max(val1_2, val2_2) * 1.33333337306976)).ToString(); TextBox textBox2 = this.textBox2; float num9 = Math.Min(val1_1, val2_1); string str1 = num9.ToString(); textBox2.Text = str1; TextBox textBox4 = this.textBox4; num9 = Math.Max(val1_2, val2_2); string str2 = num9.ToString(); textBox4.Text = str2; Gl.glOrtho((double)Math.Min(val1_1, val2_1) * 1.33333337306976, (double)Math.Max(val1_2, val2_2) * 1.33333337306976, (double)Math.Max(val1_2, val2_2), (double)Math.Min(val1_1, val2_1), -8192.0, 8192.0); Gl.glMatrixMode(5888); Gl.glLoadIdentity(); Gl.glClearColor(0.0f, 0.0627451f, 0.3764706f, 1f); Gl.glClear(16640); Gl.glColor4f(1f, 1f, 1f, 1f); Gl.glEnable(3553); Gl.glBindTexture(3553, 0); Gl.glColor4f(1f, 1f, 1f, 1f); Gl.glDisable(2884); Gl.glEnable(3008); Gl.glEnable(3042); Gl.glBlendFunc(770, 771); Gl.glAlphaFunc(519, 0.0f); Gl.glDepthFunc(515); Gl.glPolygonMode(1032, 6913); Gl.glLineWidth(2f); Gl.glColor4f(1f, 1f, 1f, 1f); for (int PlaneIdx = 0; PlaneIdx < this.k.Planes.Length; ++PlaneIdx) { if (((int)this.k.Planes[PlaneIdx].Type >> 8 & 31) == 0 || ((int)this.k.Planes[PlaneIdx].Type >> 8 & 31) == 1 || (((int)this.k.Planes[PlaneIdx].Type >> 8 & 31) == 3 || ((int)this.k.Planes[PlaneIdx].Type >> 8 & 31) == 7) || ((int)this.k.Planes[PlaneIdx].Type >> 8 & 31) == 18 || ((int)this.k.Planes[PlaneIdx].Type >> 8 & 31) == 19) { KCL.GetTriangle(this.k, PlaneIdx, out PositionA, out PositionB, out PositionC); Gl.glBegin(4); Gl.glVertex3f(PositionA.X, PositionA.Z, PositionA.Y - 100f); Gl.glVertex3f(PositionB.X, PositionB.Z, PositionB.Y - 100f); Gl.glVertex3f(PositionC.X, PositionC.Z, PositionC.Y - 100f); Gl.glEnd(); } } Gl.glDisable(10754); Gl.glPolygonMode(1032, 6914); Gl.glColor3f(0.4705882f, 0.4705882f, 0.4705882f); for (int PlaneIdx = 0; PlaneIdx < this.k.Planes.Length; ++PlaneIdx) { if (((int)this.k.Planes[PlaneIdx].Type >> 8 & 31) == 0 || ((int)this.k.Planes[PlaneIdx].Type >> 8 & 31) == 1 || (((int)this.k.Planes[PlaneIdx].Type >> 8 & 31) == 3 || ((int)this.k.Planes[PlaneIdx].Type >> 8 & 31) == 7) || ((int)this.k.Planes[PlaneIdx].Type >> 8 & 31) == 18 || ((int)this.k.Planes[PlaneIdx].Type >> 8 & 31) == 19) { KCL.GetTriangle(this.k, PlaneIdx, out PositionA, out PositionB, out PositionC); Gl.glBegin(4); Gl.glVertex3f(PositionA.X, PositionA.Z, PositionA.Y); Gl.glVertex3f(PositionB.X, PositionB.Z, PositionB.Y); Gl.glVertex3f(PositionC.X, PositionC.Z, PositionC.Y); Gl.glEnd(); } } this.img = (byte[])null; this.map = (byte[])null; System.Drawing.Bitmap b = GlNitro2.ScreenShot(this.simpleOpenGlControl1); b.MakeTransparent(Color.FromArgb(0, 16, 96)); Graphic.ConvertBitmap(b, this.pal, out this.img, out this.map, Graphic.GXTexFmt.GX_TEXFMT_PLTT16, true); b.Dispose(); this.simpleOpenGlControl1.Refresh(); }