/// <summary> /// Draws the specified effect pass onto the quad. The effect pass must have a pixel shader with the signature float2:TEXCOORD. /// </summary> /// <param name="effectPass">The effect pass.</param> /// <param name="fullScreenTriangle">if set to <c>true</c> to draw an optimized full screen triangle as a full screen quad.</param> public void Draw(EffectPass effectPass, bool fullScreenTriangle = false) { ResetShaderStages(); // Apply the Effect pass effectPass.Apply(); Draw(fullScreenTriangle); // Unapply this effect effectPass.UnApply(); }
/// <summary> /// Draws the specified effect pass onto the quad. The effect pass must have a pixel shader with the signature float2:TEXCOORD. /// </summary> /// <param name="effectPass">The effect pass.</param> public void Draw(EffectPass effectPass) { ResetShaderStages(); // Apply the Effect pass effectPass.Apply(); Draw(); // Unapply this effect effectPass.UnApply(); }
public override void Draw(Matrix world) { List <SpriteVertex> newVerts; var gotNewVerts = pendingVertexQueue.TryTake(out newVerts); if (gotNewVerts) { drawingVertices = newVerts; } if (drawingVertices == null) { return; } //pendingVertices.Add(new SpriteVertex( // new Vector3(OrbIt.ScreenWidth / 2, OrbIt.ScreenHeight / 2, 0), // new Vector2(OrbIt.ScreenHeight, OrbIt.ScreenWidth))); mvpParam.SetValue(world * OrbIt.Game.view * OrbIt.Game.projection); //pendingVertices.AddRange(permVertices); var array = drawingVertices.Count == 0 ? new[] { new SpriteVertex(Vector3.Right, Vector2.One, color: Color.Red), new SpriteVertex(Vector3.Zero, Vector2.One, (float)OrbIt.Game.Time.TotalGameTime.TotalSeconds, color: Color.Green), new SpriteVertex(Vector3.Left, Vector2.One, color: Color.Blue), new SpriteVertex(Vector3.Up, Vector2.One, color: Color.Yellow), new SpriteVertex(Vector3.Down, Vector2.One, color: Color.Brown), new SpriteVertex(Vector3.Down + Vector3.Left, Vector2.One, color: Color.Brown * Color.Blue), new SpriteVertex(Vector3.Down + Vector3.Right, Vector2.One, color: Color.Brown * Color.Red), new SpriteVertex(Vector3.Up + Vector3.Left, Vector2.One, color: Color.Yellow * Color.Blue), new SpriteVertex(Vector3.Up + Vector3.Right, Vector2.One, color: Color.Yellow * Color.Red), } : drawingVertices.ToArray(); Mesh.SetData(array); device.SetVertexBuffer(Mesh); device.SetVertexInputLayout(layout); device.SetBlendState(device.BlendStates.AlphaBlend); device.SetDepthStencilState(device.DepthStencilStates.None); effectPass.Apply(); //device.DrawAuto(PrimitiveType.PointList); device.Draw(PrimitiveType.PointList, array.Length); device.SetDepthStencilState(null); device.SetBlendState(null); effectPass.UnApply(); }