private void DrawScene(SpriteBatch spriteBatch, Stereoscopic_Mode stereo) { Stereoscopic_Graphic_Object.stereoscopic_view = stereo; DrawScene(this.spriteBatch, stereo == Stereoscopic_Mode.Right); if (stereo == Stereoscopic_Mode.Center) { return; } GraphicsDevice.SetRenderTarget(StereoscopicRenderTarget); this.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, null, null, null); // In anaglyph, left is drawn in red channel, right is drawn cyan if (Global.gameSettings.Graphics.AnaglyphMode) { Color anaglyphColor = stereo == Stereoscopic_Mode.Left ? new Color(255, 0, 0, 0) : new Color(0, 255, 255, 0); this.spriteBatch.Draw(ShaderRenderTargets[0], new Rectangle( 0, 0, StereoscopicRenderTarget.Width / 2, StereoscopicRenderTarget.Height), new Rectangle(0, 0, ShaderRenderTargets[0].Width, ShaderRenderTargets[0].Height), anaglyphColor); } // Otherwise, the left channel is drawn on the left half of the screen and the right on the right, and the display sorts it out else { int x = stereo == Stereoscopic_Mode.Left ? 0 : StereoscopicRenderTarget.Width / 2; this.spriteBatch.Draw(ShaderRenderTargets[0], new Rectangle( x, 0, StereoscopicRenderTarget.Width / 2, StereoscopicRenderTarget.Height), new Rectangle(0, 0, ShaderRenderTargets[0].Width, ShaderRenderTargets[0].Height), Color.White); } this.spriteBatch.End(); }
private void CopyMouseRender( SpriteBatch spriteBatch, RenderTarget2D renderTarget, RenderTarget2D tempTarget, Stereoscopic_Mode stereo) { GraphicsDevice.SetRenderTarget(tempTarget); GraphicsDevice.Clear(Color.Transparent); spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.LinearClamp, null, null, null); switch (stereo) { case Stereoscopic_Mode.Center: default: spriteBatch.Draw(renderTarget, Vector2.Zero, Color.White); break; case Stereoscopic_Mode.Left: spriteBatch.Draw(renderTarget, Vector2.Zero, new Rectangle(0, 0, renderTarget.Width / 2, renderTarget.Height), Color.White); break; case Stereoscopic_Mode.Right: spriteBatch.Draw(renderTarget, Vector2.Zero, new Rectangle(renderTarget.Width / 2, 0, renderTarget.Width / 2, renderTarget.Height), Color.White); break; } #if !__MOBILE__ if (Tactile.Input.IsControllingOnscreenMouse) { this.spriteBatch.Draw(MouseCursorTexture, Global.Input.mousePosition, null, Color.White, 0f, new Vector2(20, 20), 1f, SpriteEffects.None, 0f); } else if (Tactile.Input.ControlScheme == ControlSchemes.Touch) { Color tint = new Color( TouchCursorOpacity, TouchCursorOpacity, TouchCursorOpacity, TouchCursorOpacity); this.spriteBatch.Draw(MouseCursorTexture, TouchCursorLoc, null, tint, 0f, new Vector2(20, 20), 1f, SpriteEffects.None, 0f); } #endif spriteBatch.End(); }