protected override void Draw(GameTime gameTime) { GraphicsDevice.Clear(Color.CornflowerBlue); Camera.Draw(gameTime, null, ref view, ref proj); GraphicsDevice.BlendFactor = new Color(255, 255, 255, 255); GraphicsDevice.BlendState = BlendState.Opaque; GraphicsDevice.DepthStencilState = DepthStencilState.Default; GraphicsDevice.RasterizerState = RasterizerState.CullCounterClockwise; GraphicsDevice.SamplerStates[0] = SamplerState.PointWrap; GraphicsDevice.SetRenderTarget(RenderTargetMap); GraphicsDevice.Clear(Color.Transparent); MapVisible.DrawMeshWithoutPart(0, 3, Camera.CameraFrustum, ref view, ref proj); NonEuclideanRenderFunctions.DrawPlane(GraphicsDevice, illusion2plane, ref view, ref proj); NonEuclideanRenderFunctions.DrawPlane(GraphicsDevice, illusion3plane, ref view, ref proj); Teapot.Position = new Vector3(4.32f, 0.76f, -6.73f); Teapot.Draw(ref view, ref proj); Teapot.Position = new Vector3(-10.764509f, 0f, -19.796597f); Teapot.Draw(ref view, ref proj); Cup.Position = new Vector3(-6.42751f, 0f, -20.183052f); Cup.Draw(ref view, ref proj); for (int i = 0; i < 30; i++) { StairsVisible.Draw(ref view, ref proj); StairsVisible.Position.Y += 5.36f; } StairsVisible.Position.Y = 5.36f; GraphicsDevice.SetRenderTarget(NonEuclideanRenders[0]); GraphicsDevice.Clear(Color.Transparent); Teapot.Position = new Vector3(4.32f, 0.17f, -6.73f); Teapot.Draw(ref view, ref proj); GraphicsDevice.SetRenderTarget(NonEuclideanRenders[1]); GraphicsDevice.Clear(Color.Transparent); RoomIllusion1.DrawMeshWithoutPart(0, 3, Camera.CameraFrustum, ref view, ref proj); GraphicsDevice.SetRenderTarget(null); Skybox.Draw(gameTime, Camera.CameraFrustum, ref view, ref proj); _spriteBatch.Begin(); _spriteBatch.Draw(NonEuclideanRenders[1], new Rectangle(0, 0, 800, 480), Color.White); _spriteBatch.Draw(RenderTargetMap, new Rectangle(0, 0, 800, 480), Color.White); if (_illusion_visible) { /* * Vector3 p = Vector3.Transform(new Vector3(3.96f, 0.71f, -6.12f), view *proj); * Vector3 p2 = Vector3.Transform(new Vector3(4.67f, 0.17f, -6.12f), view * proj); * * p += Vector3.One; * p *= 0.5f; * p2 += Vector3.One; * p2 *= 0.5f; * p.X *= 800; * p2.X *= 800; * * p.Y *= 480; * p2.Y *= 480; * * _spriteBatch.Draw(NonEuclideanRenders[0], * new Rectangle((int)p.X, 0,(int) p2.X, 480), * new Rectangle((int)p.X, 0,(int) p2.X, 480), Color.White); ; * if(allowdebugging) Debugger.Break(); * _spriteBatch.DrawString(DefaultFont, "Second demonstration visible", new Vector2(10, 460), Color.White); */ } _spriteBatch.DrawString(DefaultFont, "DEBUG: Position = " + Camera.Position, Vector2.One, Color.Black); _spriteBatch.End(); base.Draw(gameTime); }