public override void OnDraw(MatterHackers.Agg.Graphics2D graphics2D)
        {
            //graphics2D.Clear(new RGBA_Bytes(255, 255, 255, 0));
            //Gl.glClearColor(1, 1, 1, 1);
            Gl.glClear(Gl.GL_DEPTH_BUFFER_BIT);	// Clear the Depth Buffer
            //Gl.glClear(Gl.GL_COLOR_BUFFER_BIT);	// Clear the Depth Buffer

            SetGlContext();
            SetTransforms(Width, Height);

            Gl.glTranslatef(0.0f, 0.0f, -7.0f);

            Gl.glPushMatrix();
            Gl.glMultMatrixd(mainTrackBallController.GetTransform4X4().GetAsDoubleArray());

            OnDrawGlContent();

            Gl.glPopMatrix();
            Gl.glDisable(Gl.GL_LIGHTING);

            UnsetGlContext();

            mainTrackBallController.DrawRadius(graphics2D);

            base.OnDraw(graphics2D);
        }
Beispiel #2
0
        public override void OnKeyDown(MatterHackers.Agg.UI.KeyEventArgs keyEvent)
        {
            foreach (Player aPlayer in m_Playfield.PlayerList)
            {
                aPlayer.KeyDown(keyEvent);
            }

            if (keyEvent.Control && keyEvent.KeyCode == Keys.S)
            {
                m_Playfield.SaveXML("TestSave");
            }

            base.OnKeyDown(keyEvent);
        }
Beispiel #3
0
		public static void Translate(MatterHackers.VectorMath.Vector3 vector)
		{
			if (openGlHardwareAvailable)
			{
				Translate(vector.x, vector.y, vector.z);
			}
		}
Beispiel #4
0
		public override void OnKeyDown(MatterHackers.Agg.UI.KeyEventArgs keyEvent)
		{
			if (keyEvent.KeyCode == Keys.Space)
			{
				double cx = (m_quad.GetXN(0) + m_quad.GetXN(1) + m_quad.GetXN(2) + m_quad.GetXN(3)) / 4;
				double cy = (m_quad.GetYN(0) + m_quad.GetYN(1) + m_quad.GetYN(2) + m_quad.GetYN(3)) / 4;
				Affine tr = Affine.NewTranslation(-cx, -cy);
				tr *= Affine.NewRotation(Math.PI / 2.0);
				tr *= Affine.NewTranslation(cx, cy);
				double xn0 = m_quad.GetXN(0); double yn0 = m_quad.GetYN(0);
				double xn1 = m_quad.GetXN(1); double yn1 = m_quad.GetYN(1);
				double xn2 = m_quad.GetXN(2); double yn2 = m_quad.GetYN(2);
				double xn3 = m_quad.GetXN(3); double yn3 = m_quad.GetYN(3);
				tr.transform(ref xn0, ref yn0);
				tr.transform(ref xn1, ref yn1);
				tr.transform(ref xn2, ref yn2);
				tr.transform(ref xn3, ref yn3);
				m_quad.SetXN(0, xn0); m_quad.SetYN(0, yn0);
				m_quad.SetXN(1, xn1); m_quad.SetYN(1, yn1);
				m_quad.SetXN(2, xn2); m_quad.SetYN(2, yn2);
				m_quad.SetXN(3, xn3); m_quad.SetYN(3, yn3);
				Invalidate();
			}

			base.OnKeyDown(keyEvent);
		}
Beispiel #5
0
		public Mesh(MatterHackers.PolygonMesh.Mesh polygonMesh, string name = "")
			: base(name)
		{
			this.polygonMesh = polygonMesh;
		}
Beispiel #6
0
		/*
		//---------------------------------------------------------set_orientation
		public static path_flags_e set_orientation(int c, path_flags_e o)
		{
			return clear_orientation(c) | o;
		}
		 */

		static public void shorten_path(MatterHackers.Agg.VertexSequence vs, double s)
		{
			shorten_path(vs, s, 0);
		}
Beispiel #7
0
		public override void OnKeyDown(MatterHackers.Agg.UI.KeyEventArgs keyEvent)
		{
			double dx = 0;
			double dy = 0;
			switch (keyEvent.KeyCode)
			{
				case Keys.Left: dx = -0.1; break;
				case Keys.Right: dx = 0.1; break;
				case Keys.Up: dy = 0.1; break;
				case Keys.Down: dy = -0.1; break;
			}
			m_x[0] += dx;
			m_y[0] += dy;
			m_x[1] += dx;
			m_y[1] += dy;
			Invalidate();
			base.OnKeyDown(keyEvent);
		}
		public IPrimitive GetIPrimitiveRecursive(MatterHackers.Csg.Operations.Difference objectToProcess)
		{
			List<IPrimitive> subtractItems = new List<IPrimitive>();
			foreach (CsgObject copiedObject in objectToProcess.AllSubtracts)
			{
				subtractItems.Add(GetIPrimitiveRecursive((dynamic)copiedObject));
			}

			return new MatterHackers.RayTracer.Traceable.Difference(GetIPrimitiveRecursive((dynamic)objectToProcess.Primary), BoundingVolumeHierarchy.CreateNewHierachy(subtractItems));
		}
		public override void OnDraw(MatterHackers.Agg.Graphics2D graphics2D)
		{
			if (DoOpenGlDrawing)
			{
				SetGlContext();
				OnDrawGlContent();
				UnsetGlContext();
			}

			RectangleDouble bounds = LocalBounds;
			//graphics2D.Rectangle(bounds, RGBA_Bytes.Black);

			if (DrawRotationHelperCircle)
			{
				DrawTrackballRadius(graphics2D);
			}

			base.OnDraw(graphics2D);
		}
        public void Draw(MatterHackers.Agg.Transform.ITransform Position, Graphics2D renderer)
        {
            double TextHeight = m_Position.y - 20;
            double Range = (m_DataViewMaxY - m_DataViewMinY);
            VertexSourceApplyTransform TransformedLinesToDraw;
            Stroke StrockedTransformedLinesToDraw;

            RoundedRect BackGround = new RoundedRect(m_Position.x, m_Position.y - 1, m_Position.x + m_Width, m_Position.y - 1 + m_Height + 2, 5);
            VertexSourceApplyTransform TransformedBackGround = new VertexSourceApplyTransform(BackGround, Position);
            renderer.Render(TransformedBackGround, new RGBA_Bytes(0, 0, 0, .5));

            // if the 0 line is within the window than draw it.
            if (m_DataViewMinY < 0 && m_DataViewMaxY > 0)
            {
                m_LinesToDraw.remove_all();
                m_LinesToDraw.MoveTo(m_Position.x,
                    m_Position.y + ((0 - m_DataViewMinY) * m_Height / Range));
                m_LinesToDraw.LineTo(m_Position.x + m_Width,
                    m_Position.y + ((0 - m_DataViewMinY) * m_Height / Range));
                TransformedLinesToDraw = new VertexSourceApplyTransform(m_LinesToDraw, Position);
                StrockedTransformedLinesToDraw = new Stroke(TransformedLinesToDraw);
            	renderer.Render(StrockedTransformedLinesToDraw, new RGBA_Bytes(0, 0, 0, 1));
            }

            double MaxMax = -999999999;
            double MinMin = 999999999;
            double MaxAverage = 0;
            foreach (KeyValuePair<String, HistoryData> historyKeyValue in m_DataHistoryArray)
	        {
                HistoryData history = historyKeyValue.Value;
                m_LinesToDraw.remove_all();
                MaxMax = System.Math.Max(MaxMax, history.GetMaxValue());
                MinMin = System.Math.Min(MinMin, history.GetMinValue());
                MaxAverage = System.Math.Max(MaxAverage, history.GetAverageValue());
		        for(int i = 0; i < m_Width - 1; i++)
		        {
                    if(i==0)
                    {
                        m_LinesToDraw.MoveTo(m_Position.x + i,
                            m_Position.y + ((history.GetItem(i) - m_DataViewMinY) * m_Height / Range));
                    }
                    else
                    {
                        m_LinesToDraw.LineTo(m_Position.x + i,
                            m_Position.y + ((history.GetItem(i) - m_DataViewMinY) * m_Height / Range));
                    }
		        }

                TransformedLinesToDraw = new VertexSourceApplyTransform(m_LinesToDraw, Position);
                StrockedTransformedLinesToDraw = new Stroke(TransformedLinesToDraw);
            	renderer.Render(StrockedTransformedLinesToDraw, history.m_Color);
                
                String Text = historyKeyValue.Key + ": Min:" + MinMin.ToString("0.0") + " Max:" + MaxMax.ToString("0.0");
                renderer.DrawString(Text, m_Position.x, TextHeight - m_Height);
                TextHeight -= 20;
            }

            RoundedRect BackGround2 = new RoundedRect(m_Position.x, m_Position.y - 1, m_Position.x + m_Width, m_Position.y - 1 + m_Height + 2, 5);
            VertexSourceApplyTransform TransformedBackGround2 = new VertexSourceApplyTransform(BackGround2, Position);
            Stroke StrockedTransformedBackGround = new Stroke(TransformedBackGround2);
           	renderer.Render(StrockedTransformedBackGround, new RGBA_Bytes(0.0, 0, 0, 1));

            //renderer.Color = BoxColor;
            //renderer.DrawRect(m_Position.x, m_Position.y - 1, m_Width, m_Height + 2);
        }
Beispiel #11
0
 public override void OnKeyUp(MatterHackers.Agg.UI.KeyEventArgs keyEvent)
 {
     foreach (Player aPlayer in m_Playfield.PlayerList)
     {
         aPlayer.KeyUp(keyEvent);
     }
     base.OnKeyUp(keyEvent);
 }