private void viewportWindowToolStripMenuItem_Click(object sender, EventArgs e) { if (viewportWindowToolStripMenuItem.Checked == false) { var vp = new VBNViewport(); viewports.Add(vp); AddDockedControl(vp); viewportWindowToolStripMenuItem.Checked = true; } }
public void Render(Matrix4 view) { if (b == null) return; Matrix4 mat = b.transform; Vector3 center = Vector3.Transform(Vector3.Zero, mat); Vector3 point; hit = false; bool _hiX = false; bool _hiY = false; bool _hiZ = false; if (RenderTools.CheckSphereHit(center, 2, VBNViewport.p1, VBNViewport.p2, out point)) { hit = true; VBNViewport.LineSphereIntersect(VBNViewport.p1, VBNViewport.p2, center, 2, out point); Vector3 angle = Angles(Vector3.Transform(point, b.invert)) * new Vector3(180f / (float)Math.PI); angle.X = Math.Abs(angle.X); angle.Y = Math.Abs(angle.Y); angle.Z = Math.Abs(angle.Z); //Console.WriteLine(angle.ToString()); float _axisSnapRange = 7f; if (Math.Abs(angle.Y - 90.0f) <= _axisSnapRange) _hiX = true; else if (angle.X >= (180.0f - _axisSnapRange) || angle.X <= _axisSnapRange) _hiY = true; else if (angle.Y >= (180.0f - _axisSnapRange) || angle.Y <= _axisSnapRange) _hiZ = true; } GL.PushMatrix(); GL.MultMatrix(ref mat); GL.Color3(_hiX ? Color.Yellow : Color.Green); GL.LineWidth(2); RenderTools.drawCircleOutline(Vector3.Zero, 2, 25); GL.Rotate(90.0f, 0.0f, 1.0f, 0.0f); GL.Color3(_hiY ? Color.Yellow : Color.Red); RenderTools.drawCircleOutline(Vector3.Zero, 2, 25); GL.Rotate(90.0f, 1.0f, 0.0f, 0.0f); GL.Color3(_hiZ ? Color.Yellow : Color.Blue); RenderTools.drawCircleOutline(Vector3.Zero, 2, 25); GL.PopMatrix(); }
private void LetsDance(object sender, EventArgs e) { VBNViewport view = MainForm.Instance.viewports[0]; view.CurrentMode = VBNViewport.Mode.Normal; NUT n = null; if (((MenuItem)sender).GetContextMenu().SourceControl == stock_90_renderer) { n = stock_90; } if (((MenuItem)sender).GetContextMenu().SourceControl == chr_00_renderer) { n = chr_00; } if (((MenuItem)sender).GetContextMenu().SourceControl == chr_11_renderer) { n = chr_11; } if (((MenuItem)sender).GetContextMenu().SourceControl == chr_13_renderer) { n = chr_13; } if (n == null) { return; } byte[] data = RenderTools.DXT5ScreenShot(view.glControl1, view.shootX, view.shootY, view.shootWidth, view.shootHeight); int id = n.textures.Count > 0 ? n.textures[0].id : 0x280052B7; n.Destroy(); n.textures.Clear(); n.draw.Clear(); NUT.NUD_Texture tex = new NUT.NUD_Texture(); tex.width = view.shootWidth; tex.height = view.shootHeight; tex.mipmaps.Add(FlipDXT5(data, tex.width, tex.height)); tex.type = PixelInternalFormat.CompressedRgbaS3tcDxt5Ext; tex.id = id; n.textures.Add(tex); n.draw.Add(tex.id, NUT.loadImage(tex)); ((MenuItem)sender).GetContextMenu().SourceControl.Invalidate(); if (((MenuItem)sender).GetContextMenu().SourceControl == stock_90_renderer) { if (stock_90_loc != null) { stock_90.Save(stock_90_loc); } } if (((MenuItem)sender).GetContextMenu().SourceControl == chr_00_renderer) { if (chr_00_loc != null) { chr_00.Save(chr_00_loc); } } if (((MenuItem)sender).GetContextMenu().SourceControl == chr_11_renderer) { if (chr_11_loc != null) { chr_11.Save(chr_13_loc); } } if (((MenuItem)sender).GetContextMenu().SourceControl == chr_13_renderer) { if (chr_13_loc != null) { chr_13.Save(chr_13_loc); } } }