public override bool Draw() { if (!base.Draw()) { return(false); } UsingEffect.Projection = Matrix.CreateOrthographicOffCenter(0, ParentViewport.ViewportPtr.Width, ParentViewport.ViewportPtr.Height, 0, 1.0f, 1000.0f); if (CurrentTexture == null) { UsingEffect.TextureEnabled = false; UsingEffect.Texture = null; } else { UsingEffect.TextureEnabled = true; UsingEffect.Texture = CurrentTexture; } UsingEffect.Begin(); foreach (EffectPass pass in UsingEffect.CurrentTechnique.Passes) { pass.Begin(); UsingEffect.GraphicsDevice.VertexDeclaration = new VertexDeclaration(UsingEffect.GraphicsDevice, VertexPositionColorTexture.VertexElements); UsingEffect.GraphicsDevice.DrawUserIndexedPrimitives <VertexPositionColorTexture>(PrimitiveType.TriangleList, m_Vectors, 0, 4, sm_Indices, 0, 2); pass.End(); } UsingEffect.End(); return(true); }
public override bool Draw() { if (!base.Draw()) { return(false); } if (CommonTexture != null) { UsingEffect.TextureEnabled = true; UsingEffect.Texture = CommonTexture; } else { UsingEffect.TextureEnabled = false; UsingEffect.Texture = null; } UsingEffect.Projection = Matrix.CreateOrthographicOffCenter(0, ParentViewport.ViewportPtr.Width, ParentViewport.ViewportPtr.Height, 0, 1.0f, 1000.0f); UsingEffect.Begin(); foreach (EffectPass pass in UsingEffect.CurrentTechnique.Passes) { pass.Begin(); UsingEffect.GraphicsDevice.VertexDeclaration = new VertexDeclaration(UsingEffect.GraphicsDevice, VertexPositionColorTexture.VertexElements); UsingEffect.GraphicsDevice.DrawUserPrimitives <VertexPositionColorTexture>(PrimitiveType.TriangleList, m_Vectors.ToArray(), 0, m_Vectors.Count / 3); pass.End(); } UsingEffect.End(); //UsingEffect.TextureEnabled = false; //UsingEffect.Begin(); //foreach (EffectPass pass in UsingEffect.CurrentTechnique.Passes) //{ // pass.Begin(); // UsingEffect.GraphicsDevice.VertexDeclaration = new VertexDeclaration(UsingEffect.GraphicsDevice, VertexPositionColor.VertexElements); // UsingEffect.GraphicsDevice.DrawUserPrimitives<VertexPositionColor>(PrimitiveType.LineList, m_TempBufferCurve.ToArray(), 0, m_TempBufferCurve.Count / 2); // pass.End(); //} //UsingEffect.End(); return(true); }
public void Draw(GraphicsDevice device) { ConfirmUsingEffect(device); var srcViewport = device.Viewport; foreach (var vi in RenderingViewports) { vi.DrawElements(); } UsingEffect.Begin(); foreach (EffectPass pass in UsingEffect.CurrentTechnique.Passes) { pass.Begin(); UsingEffect.GraphicsDevice.Viewport = srcViewport; if (m_VertexDeclaration == null || m_VertexDeclaration.GraphicsDevice != device) { m_VertexDeclaration = new VertexDeclaration(device, VertexPositionColor.VertexElements); } UsingEffect.GraphicsDevice.VertexDeclaration = m_VertexDeclaration; if (!IsSelectedViewportMaximized) { UsingEffect.GraphicsDevice.DrawUserPrimitives <VertexPositionColor>(PrimitiveType.LineList, m_vViewCutLinePts, 0, 2); } if (m_vSelectedFramePts.Count > 0) { UsingEffect.GraphicsDevice.DrawUserIndexedPrimitives <VertexPositionColor>(PrimitiveType.LineStrip, m_vSelectedFramePts.ToArray(), 0, 8, m_SelectedFrameIndices, 0, 9); } foreach (var vi in RenderingViewports) { vi.DrawFrame(UsingEffect); } pass.End(); } UsingEffect.End(); device.Viewport = srcViewport; }
public void Draw(GraphicsDevice device) { device.Clear(Color.Black); ConfirmUsingEffect(device); UsingEffect.Begin(); device.Viewport = PanelViewport; foreach (EffectPass pass in UsingEffect.CurrentTechnique.Passes) { pass.Begin(); foreach (var ln in Lines.Values) { ln.Draw(device); } TimeRuler.Draw(device); pass.End(); } UsingEffect.End(); var rect = device.Viewport.TitleSafeArea; var rectDest = device.Viewport.TitleSafeArea; rectDest.X -= CurViewOffsetX; device.Present(rect, rectDest, (IntPtr)ParentPanel.Handle); }