本文整理汇总了C#中RenderHelper.ResyncStates方法的典型用法代码示例。如果您正苦于以下问题:C# RenderHelper.ResyncStates方法的具体用法?C# RenderHelper.ResyncStates怎么用?C# RenderHelper.ResyncStates使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RenderHelper
的用法示例。
在下文中一共展示了RenderHelper.ResyncStates方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Draw
/// <summary>
/// Draws the specified game time.
/// </summary>
/// <param name="gameTime">The game time.</param>
/// <param name="world">The world.</param>
/// <param name="render">The render.</param>
protected void Draw(GameTime gameTime, IWorld world, RenderHelper render)
{
Matrix view = world.CameraManager.ActiveCamera.View;
Matrix projection = world.CameraManager.ActiveCamera.Projection;
world.Culler.StartFrame(ref view, ref projection, world.CameraManager.ActiveCamera.BoundingFrustum);
List<IObject> AllnotCulledObjectsList = world.Culler.GetNotCulledObjectsList(null);
List<IObject> DeferrednotCulledObjectsList = world.Culler.GetNotCulledObjectsList(MaterialType.DEFERRED);
List<IObject> ForwardnotCulledObjectsList = world.Culler.GetNotCulledObjectsList(MaterialType.FORWARD);
if (desc.OrderAllObjectsBeforeDraw != null)
AllnotCulledObjectsList = desc.OrderAllObjectsBeforeDraw(AllnotCulledObjectsList);
if (desc.OrderDeferredObjectsBeforeDraw != null)
DeferrednotCulledObjectsList = desc.OrderDeferredObjectsBeforeDraw(DeferrednotCulledObjectsList);
if (desc.OrderForwardObjectsBeforeDraw != null)
ForwardnotCulledObjectsList = desc.OrderForwardObjectsBeforeDraw(ForwardnotCulledObjectsList);
render.SetSamplerStates(ginfo.SamplerState);
render.DettachBindedTextures();
deferredGBuffer.PreDrawScene(gameTime, world, render, ginfo, AllnotCulledObjectsList);
render.SetSamplerStates(ginfo.SamplerState);
render.DettachBindedTextures();
deferredGBuffer.SetGBuffer(render);
deferredGBuffer.ClearGBuffer(render);
deferredGBuffer.DrawScene(gameTime, world, render, ginfo, DeferrednotCulledObjectsList);
deferredGBuffer.ResolveGBuffer(render);
render[PrincipalConstants.DephRT] = deferredGBuffer[GBufferTypes.DEPH];
render[PrincipalConstants.normalRt] = deferredGBuffer[GBufferTypes.NORMAL];
render.DettachBindedTextures();
render.ValidateSamplerStates();
deferredLightMap.SetLightMap(render);
deferredLightMap.DrawLights(gameTime, world, deferredGBuffer, render);
deferredLightMap.ResolveLightMap(render);
render[PrincipalConstants.lightRt] = deferredLightMap[DeferredLightMapType.LIGHTMAP];
render.DettachBindedTextures(5);
render.ValidateSamplerStates();
render.PushRenderTarget(scenerender);
render.Clear(desc.BackGroundColor);
foreach (IObject item in AllnotCulledObjectsList)
{
if (item.Material.IsVisible)
item.Material.PosDrawnPhase(gameTime, item, world.CameraManager.ActiveCamera, world.Lights, render);
}
render.DettachBindedTextures(3);
render.ValidateSamplerStates();
if (world.PhysicWorld.isDebugDraw)
{
world.PhysicWorld.iDebugDrawn(render, gameTime, world.CameraManager.ActiveCamera);
}
if (world.ParticleManager != null)
{
world.ParticleManager.iDraw(gameTime, world.CameraManager.ActiveCamera.View, world.CameraManager.ActiveCamera.Projection, render);
render.ResyncStates();
render.SetSamplerStates(ginfo.SamplerState);
}
render.DettachBindedTextures(6);
render.ValidateSamplerStates();
render.RenderPosWithDepthComponents(gameTime, ref view, ref projection);
render.DettachBindedTextures(6);
render.ValidateSamplerStates();
render[PrincipalConstants.colorRT] = scenerender;
render[PrincipalConstants.normalRt] = deferredGBuffer[GBufferTypes.NORMAL];
render[PrincipalConstants.lightRt] = deferredLightMap[DeferredLightMapType.LIGHTMAP];
render[PrincipalConstants.DephRT] = deferredGBuffer[GBufferTypes.DEPH];
render[PrincipalConstants.extra1RT] = deferredGBuffer[GBufferTypes.Extra1];
render[PrincipalConstants.CurrentImage] = render[PrincipalConstants.CombinedImage] = render.PopRenderTargetAsSingleRenderTarget2D();
for (int i = 0; i < PostEffects.Count; i++)
{
if (PostEffects[i].Enabled)
{
render.PushRenderTarget(PostEffectTarget);
render.Clear(Color.Black);
PostEffects[i].Draw(render[PrincipalConstants.CurrentImage], render, gameTime, ginfo, world, true);
Texture2D tex = render.PopRenderTarget()[0].RenderTarget as Texture2D;
render[PrincipalConstants.CurrentImage] = tex;
SwapTargetBuffers();
}
//.........这里部分代码省略.........
示例2: BeginDraw
protected override void BeginDraw(Microsoft.Xna.Framework.GameTime gt, RenderHelper render, Engine.GraphicInfo ginfo)
{
manager.BeginDraw(gt);
manager.Draw(gt);
render.ResyncStates();
}
示例3: Draw
/// <summary>
/// Draws the specified game time.
/// </summary>
/// <param name="gameTime">The game time.</param>
/// <param name="world">The world.</param>
/// <param name="render">The render.</param>
protected void Draw(GameTime gameTime, IWorld world, RenderHelper render)
{
Matrix view = world.CameraManager.ActiveCamera.View;
Matrix projection = world.CameraManager.ActiveCamera.Projection;
world.Culler.StartFrame(ref view, ref projection, world.CameraManager.ActiveCamera.BoundingFrustum);
List<IObject> AllnotCulledObjectsList = world.Culler.GetNotCulledObjectsList(null);
List<IObject> DeferrednotCulledObjectsList = world.Culler.GetNotCulledObjectsList(MaterialType.DEFERRED, CullerComparer.ComparerFrontToBack,world.CameraManager.ActiveCamera.Position);
List<IObject> ForwardnotCulledObjectsList = world.Culler.GetNotCulledObjectsList(MaterialType.FORWARD, CullerComparer.ComparerBackToFront, world.CameraManager.ActiveCamera.Position);
if (desc.OrderAllObjectsBeforeDraw != null)
AllnotCulledObjectsList = desc.OrderAllObjectsBeforeDraw(AllnotCulledObjectsList,world);
if (desc.OrderDeferredObjectsBeforeDraw != null)
DeferrednotCulledObjectsList = desc.OrderDeferredObjectsBeforeDraw(DeferrednotCulledObjectsList, world);
if (desc.OrderForwardObjectsBeforeDraw != null)
ForwardnotCulledObjectsList = desc.OrderForwardObjectsBeforeDraw(ForwardnotCulledObjectsList, world);
render.SetSamplerStates(ginfo.SamplerState);
render.DettachBindedTextures();
deferredGBuffer.PreDrawScene(gameTime, world, render, ginfo, AllnotCulledObjectsList);
render.SetSamplerStates(ginfo.SamplerState);
render.DettachBindedTextures();
deferredGBuffer.SetGBuffer(render);
deferredGBuffer.ClearGBuffer(render);
deferredGBuffer.DrawScene(gameTime, world, render, ginfo, DeferrednotCulledObjectsList);
deferredGBuffer.ResolveGBuffer(render);
render.DettachBindedTextures();
render.ValidateSamplerStates();
deferredLightMap.SetLightMap(render);
deferredLightMap.DrawLights(gameTime, world, deferredGBuffer, render);
deferredLightMap.ResolveLightMap(render);
render.DettachBindedTextures(5);
render.ValidateSamplerStates();
deferredFinalCombination.SetFinalCombination(render);
deferredFinalCombination.DrawScene(gameTime, world, deferredGBuffer, deferredLightMap,render);
render.DettachBindedTextures(3);
render.ValidateSamplerStates();
if (desc.ExtraForwardPass)
{
render[PrincipalConstants.colorRT] = deferredGBuffer[GBufferTypes.COLOR];
render[PrincipalConstants.normalRt] = deferredGBuffer[GBufferTypes.NORMAL];
render[PrincipalConstants.lightRt] = deferredLightMap[DeferredLightMapType.LIGHTMAP];
render[PrincipalConstants.DephRT] = deferredGBuffer[GBufferTypes.DEPH];
render[PrincipalConstants.extra1RT] = deferredGBuffer[GBufferTypes.Extra1];
render[PrincipalConstants.CombinedImage] = deferredFinalCombination[GBufferTypes.FINALIMAGE];
render[PrincipalConstants.CurrentImage] = deferredFinalCombination[GBufferTypes.FINALIMAGE];
if (desc.RestoreDepthOption == RestoreDepthOption.BEFORE_POSTEFFECT)
{
restoreDepth.PerformForwardPass(render[PrincipalConstants.CombinedImage], render[PrincipalConstants.DephRT], render,ginfo);
render.DettachBindedTextures(2);
render.ValidateSamplerStates();
if (world.PhysicWorld.isDebugDraw)
{
world.PhysicWorld.iDebugDrawn(render, gameTime, world.CameraManager.ActiveCamera);
}
if (world.ParticleManager != null)
{
world.ParticleManager.iDraw(gameTime, world.CameraManager.ActiveCamera.View, world.CameraManager.ActiveCamera.Projection, render);
render.ResyncStates();
render.SetSamplerStates(ginfo.SamplerState);
}
render.DettachBindedTextures(6);
render.ValidateSamplerStates();
forwardPass.Draw(gameTime, world, render,DeferrednotCulledObjectsList,ForwardnotCulledObjectsList);
render.DettachBindedTextures(6);
render.ValidateSamplerStates();
render.RenderPosWithDepthComponents(gameTime, ref view, ref projection);
render.DettachBindedTextures(6);
render.ValidateSamplerStates();
render[PrincipalConstants.CurrentImage] = restoreDepth.EndForwardPass(render);
render[PrincipalConstants.CombinedImage] = render[PrincipalConstants.CurrentImage];
for (int i = 0; i < PostEffects.Count; i++)
//.........这里部分代码省略.........