public override bool NextPass() { if (Pass == 0) { Batch.Pause(); PPXDepthEngine.SetPPXTarget(Target, DepthTarget, true); Batch.OutputDepth = true; //depth surface always uses depth techniques Batch.Resume(); Pass++; return(true); } return(false); /*else if (Pass == 1) * { * if (FSOEnvironment.UseMRT) return false; * else * { * Batch.Pause(); * GD.SetRenderTarget(DepthTarget); * Batch.OutputDepth = true; * Batch.Resume(); * Pass++; * return true; * } * } * return false;*/ }
public virtual void Dispose() { Batch.Pause(); PPXDepthEngine.SetPPXTarget(null, null, false); ExtractPixelTexture(); Batch.Resume(); }
public override void PreDraw(GraphicsDevice device) { if (HasInit == false) { return; } var boundfactor = 0.5f; boundfactor *= Blueprint?.Width ?? 64; var off = 0.5f * (Blueprint?.Width ?? 64); var tile = State.CenterTile; tile = new Vector2(Math.Min(boundfactor + off, Math.Max(off - boundfactor, tile.X)), Math.Min(boundfactor + off, Math.Max(off - boundfactor, tile.Y))); if (tile != State.CenterTile) { State.CenterTile = tile; } State._2D.PreciseZoom = State.PreciseZoom; State.OutsideColor = Blueprint.OutsideColor; FSO.Common.Rendering.Framework.GameScreen.ClearColor = new Color(State.OutsideColor.ToVector4()); //new Color(0x72, 0x72, 0x72).ToVector4() * var frustrum = new BoundingFrustum(State.Camera.View * State.Camera.Projection); foreach (var sub in Blueprint.SubWorlds) { var bounds = ((SubWorldComponentRC)sub).Bounds; if (bounds.Intersects(frustrum)) { sub.PreDraw(device, State); } } State.UpdateInterpolation(); if (Blueprint != null) { foreach (var ent in Blueprint.Objects) { ent.Update(null, State); } } //For all the tiles in the dirty list, re-render them State.PrepareLighting(); _2DWorld.PreDraw(device, State); device.SetRenderTarget(null); State._3D.Begin(device); _3DWorld.PreDraw(device, State); State._3D.End(); if (UseBackbuffer) { PPXDepthEngine.SetPPXTarget(null, null, true, State.OutsideColor); InternalDraw(device); device.SetRenderTarget(null); } return; }
public override void Dispose() { Batch.Pause(); Batch.OutputDepth = false; PPXDepthEngine.SetPPXTarget(null, null, false); //need to unbind both before we can extract their textures. ExtractPixelTexture(); ExtractDepthTexture(); Batch.Resume(); }
public virtual bool NextPass() { if (Pass == 0) { Batch.Pause(); PPXDepthEngine.SetPPXTarget(Target, null, true); Batch.Resume(); Pass++; return(true); } return(false); }
/// <summary> /// Pre-Draw /// </summary> /// <param name="device"></param> public override void PreDraw(GraphicsDevice device) { base.PreDraw(device); if (HasInit == false) { return; } BoundView(); State._2D.PreciseZoom = State.PreciseZoom; State.OutsideColor = Blueprint.OutsideColor; FSO.Common.Rendering.Framework.GameScreen.ClearColor = new Color(new Color(0x72, 0x72, 0x72).ToVector4() * State.OutsideColor.ToVector4()); foreach (var sub in Blueprint.SubWorlds) { sub.PreDraw(device, State); } State.UpdateInterpolation(); if (Blueprint != null) { foreach (var ent in Blueprint.Objects) { ent.Update(null, State); } } //For all the tiles in the dirty list, re-render them //PPXDepthEngine.SetPPXTarget(null, null, true); State.PrepareLighting(); State._2D.Begin(this.State.Camera); _2DWorld.PreDraw(device, State); device.SetRenderTarget(null); State._2D.End(); State._3D.Begin(device); _3DWorld.PreDraw(device, State); State._3D.End(); if (UseBackbuffer) { PPXDepthEngine.SetPPXTarget(null, null, true); InternalDraw(device); device.SetRenderTarget(null); } return; }
/// <summary> /// Pre-Draw /// </summary> /// <param name="device"></param> public override void PreDraw(GraphicsDevice device) { base.PreDraw(device); if (HasInit == false) { return; } if (Blueprint != null) { foreach (var ent in Blueprint.Objects) { ent.Update(null, State); } } //For all the tiles in the dirty list, re-render them //PPXDepthEngine.SetPPXTarget(null, null, true); State._2D.Begin(this.State.Camera); _2DWorld.PreDraw(device, State); device.SetRenderTarget(null); State._2D.End(); State._3D.Begin(device); _3DWorld.PreDraw(device, State); State._3D.End(); if (FSOEnvironment.SoftwareDepth) { PPXDepthEngine.SetPPXTarget(null, null, true); InternalDraw(device); device.SetRenderTarget(null); } return; }
/// <summary> /// Pre-Draw /// </summary> /// <param name="device"></param> public override void PreDraw(GraphicsDevice device) { //bound the scroll so we can't see gray space. float boundfactor = 0.5f; switch (State.Zoom) { case WorldZoom.Near: boundfactor = 1.20f; break; case WorldZoom.Medium: boundfactor = 1.05f; break; } boundfactor *= Blueprint?.Width ?? 64; var off = 0.5f * (Blueprint?.Width ?? 64); var tile = State.CenterTile; tile = new Vector2(Math.Min(boundfactor + off, Math.Max(off - boundfactor, tile.X)), Math.Min(boundfactor + off, Math.Max(off - boundfactor, tile.Y))); if (tile != State.CenterTile) { State.CenterTile = tile; } base.PreDraw(device); if (HasInit == false) { return; } State._2D.PreciseZoom = State.PreciseZoom; State.OutsideColor = Blueprint.OutsideColor; foreach (var sub in Blueprint.SubWorlds) { sub.PreDraw(device, State); } if (Blueprint != null) { foreach (var ent in Blueprint.Objects) { ent.Update(null, State); } } //For all the tiles in the dirty list, re-render them //PPXDepthEngine.SetPPXTarget(null, null, true); State.PrepareLighting(); State._2D.Begin(this.State.Camera); _2DWorld.PreDraw(device, State); device.SetRenderTarget(null); State._2D.End(); State._3D.Begin(device); _3DWorld.PreDraw(device, State); State._3D.End(); if (UseBackbuffer) { PPXDepthEngine.SetPPXTarget(null, null, true); InternalDraw(device); device.SetRenderTarget(null); } return; }