public void RenderGame(RenderFunction renderFunction, Color clearColor) { // draw true image setRenderTarget(TrueGameScreen, clearColor); SpriteBatch.BeginPixelPerfect(trueScaleMatrix, SpriteSortMode.FrontToBack); renderFunction(); SpriteBatch.End(); // apply the shader setRenderTarget(ShadedGameScreen, Color.Black); SpriteBatch.BeginPixelPerfect(trueScaleMatrix); PostProcessors?.Invoke(); SpriteBatch.Draw(TrueGameScreen, Vector2.Zero, Color.White); SpriteBatch.End(); // if requested, save shaded screenshot (before scaling) if (takeScreenshot) { takeScreenshot = false; ShadedGameScreen.SaveAsTimestampedPng(); } }
internal void RenderOverlay(RenderFunction renderFunction) { SpriteBatch.BeginPixelPerfect(trueScaleMatrix, SpriteSortMode.FrontToBack); renderFunction(); SpriteBatch.End(); }
public GooseEntity(TickFunction t, UpdateRigFunction ur, RenderFunction r) { tick = t; updateRig = ur; render = r; }
/// <summary> /// Inizializza la generazione (tramite rendering to target) della CubeMap. (Va utilizzato nel GameLoop prima dell'inizio del frame [specificato da LogiX_Technologies.LogiX_Engine.StartRender()] o dopo la fine del frame [specificata da LogiX_Technologies.LogiX_Engine.EndRender()]) /// </summary> /// <param name="function"></param> /// <param name="CenterOfCube"></param> /// <returns></returns> public bool RenderToCube(RenderFunction function, VertexData CenterOfCube) { try { renderToEnvy.BeginCube(cube); backViewPort = LogiX_Engine.Device.Viewport; LogiX_Engine.Device.Viewport = viewport; Vector3 v = new Vector3(); Vector3 upV = new Vector3(); for (int i = 0; i < 6; i++) { switch (i) { case (int)CubeMapFace.PositiveX: cam.Position = CenterOfCube; cam.Look = new VertexData(1, 0, 0) + CenterOfCube; cam.UpVector = new VertexData(0, 1, 0); break; case (int)CubeMapFace.NegativeX: cam.Position = CenterOfCube; cam.Look = new VertexData(-1, 0, 0) + CenterOfCube; cam.UpVector = new VertexData(0, 1, 0); break; case (int)CubeMapFace.PositiveY: cam.Position = CenterOfCube; cam.Look = new VertexData(0, 1, 0) + CenterOfCube; cam.UpVector = new VertexData(0, 0, -1); break; case (int)CubeMapFace.NegativeY: cam.Position = CenterOfCube; cam.Look = new VertexData(0, -1, 0) + CenterOfCube; cam.UpVector = new VertexData(0, 0, 1); break; case (int)CubeMapFace.PositiveZ: cam.Position = CenterOfCube; cam.Look = new VertexData(0, 0, 1) + CenterOfCube; cam.UpVector = new VertexData(0, 1, 0); break; case (int)CubeMapFace.NegativeZ: cam.Position = CenterOfCube; cam.Look = new VertexData(0, 0, -1) + CenterOfCube; cam.UpVector = new VertexData(0, 1, 0); break; } cam.Capture(); SetFace((CubeMapFace)i); function.Invoke(); } renderToEnvy.End(1); LogiX_Engine.Device.Viewport = backViewPort; return true; } catch { Error("OnRenderToCube"); return false; } }