本文整理汇总了C#中RenderHelper.PeekBlendState方法的典型用法代码示例。如果您正苦于以下问题:C# RenderHelper.PeekBlendState方法的具体用法?C# RenderHelper.PeekBlendState怎么用?C# RenderHelper.PeekBlendState使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RenderHelper
的用法示例。
在下文中一共展示了RenderHelper.PeekBlendState方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DrawScene
public void DrawScene(GameTime gameTime, IWorld world, RenderHelper render, GraphicInfo ginfo, List<IObject> objs)
{
Matrix v = world.CameraManager.ActiveCamera.View;
Matrix p = world.CameraManager.ActiveCamera.Projection;
render.PushRenderTarget(colorRT, normalRT, depthRT, lightOclusionRT);
render.RenderPreComponents(gameTime, ref v, ref p);
System.Diagnostics.Debug.Assert(render.PeekBlendState() == BlendState.Opaque);
System.Diagnostics.Debug.Assert(render.PeekDepthState() == DepthStencilState.Default);
System.Diagnostics.Debug.Assert(render.PeekRasterizerState() == RasterizerState.CullCounterClockwise);
render.SetSamplerState(ginfo.SamplerState, 0);
foreach (IObject item in objs)
{
item.Material.Drawn(gameTime,item, world.CameraManager.ActiveCamera, world.Lights, render);
}
render.PopRenderTarget();
colorRTFINAL = colorRT2;
render.PushRenderTarget(colorRTFINAL);
render.Clear(Color.CornflowerBlue);
effect.Parameters["View"].SetValue(world.CameraManager.ActiveCamera.View);
effect.Parameters["Projection"].SetValue(world.CameraManager.ActiveCamera.Projection);
{
foreach (IObject item in world.Culler.GetNotCulledObjectsList(MaterialType.DEFERRED))
{
for (int i = 0; i < item.Modelo.MeshNumber; i++)
{
BatchInformation[] bi = item.Modelo.GetBatchInformation(i);
for (int j = 0; j < bi.Count(); j++)
{
effect.Parameters["Texture"].SetValue(item.Modelo.getTexture(TextureType.DIFFUSE,i,j));
effect.Parameters["World"].SetValue(bi[j].ModelLocalTransformation * item.WorldMatrix);
render.RenderBatch(bi[j], effect);
}
}
}
}
render.PopRenderTarget();
}
示例2: DrawScene
public void DrawScene(GameTime gameTime, IWorld world, RenderHelper render, GraphicInfo ginfo, List<IObject> objectsToDraw)
{
render.ValidateSamplerStates();
Matrix view = world.CameraManager.ActiveCamera.View;
Matrix projection = world.CameraManager.ActiveCamera.Projection;
if (render.RenderPreComponents(gameTime, ref view, ref projection) > 0)
{
render.SetSamplerStates(ginfo.SamplerState);
}
System.Diagnostics.Debug.Assert(render.PeekBlendState() == BlendState.Opaque);
System.Diagnostics.Debug.Assert(render.PeekDepthState() == DepthStencilState.Default);
System.Diagnostics.Debug.Assert(render.PeekRasterizerState() == RasterizerState.CullCounterClockwise);
render.DettachBindedTextures(5);
foreach (IObject item in objectsToDraw)
{
if(item.Material.IsVisible)
item.Material.Drawn(gameTime,item, world.CameraManager.ActiveCamera, world.Lights, render);
}
render.ValidateSamplerStates();
}
示例3: Draw
//.........这里部分代码省略.........
render[PrincipalConstants.CurrentImage] = tex;
SwapTargetBuffers();
}
}
render.SetSamplerStates(ginfo.SamplerState);
render.DettachBindedTextures(16);
restoreDepth.PerformForwardPass(render[PrincipalConstants.CurrentImage], render[PrincipalConstants.DephRT], render, ginfo);
render.DettachBindedTextures(2);
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(16);
forwardPass.Draw(gameTime, world, render,DeferrednotCulledObjectsList,ForwardnotCulledObjectsList);
render.DettachBindedTextures(16);
render.RenderPosWithDepthComponents(gameTime, ref view, ref projection);
render.DettachBindedTextures(16);
render[PrincipalConstants.CurrentImage] = restoreDepth.EndForwardPass(render);
if (desc.UseFloatingBufferForLightMap)
{
System.Diagnostics.Debug.Assert(render.PeekBlendState() == BlendState.Opaque);
render.Clear(Color.Black);
render.RenderTextureComplete(render[PrincipalConstants.CurrentImage], Color.White, ginfo.FullScreenRectangle, Matrix.Identity, null, true, SpriteSortMode.Deferred, SamplerState.PointClamp);
System.Diagnostics.Debug.Assert(render.PeekBlendState() == BlendState.Opaque);
}
else
{
render.Clear(Color.Black);
render.RenderTextureComplete(render[PrincipalConstants.CurrentImage], Color.White, ginfo.FullScreenRectangle, Matrix.Identity, null, true, SpriteSortMode.Deferred, ginfo.SamplerState);
}
}
else if (desc.RestoreDepthOption == RestoreDepthOption.NONE)
{
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, desc.UseFloatingBufferForLightMap);
Texture2D tex = render.PopRenderTarget()[0].RenderTarget as Texture2D;
System.Diagnostics.Debug.Assert(tex != null);
render[PrincipalConstants.CurrentImage] = tex;
SwapTargetBuffers();
}
}
if (desc.UseFloatingBufferForLightMap)
{
render.Clear(Color.Black);
render.RenderTextureComplete(render[PrincipalConstants.CurrentImage], Color.White, ginfo.FullScreenRectangle, Matrix.Identity, null, true, SpriteSortMode.Deferred, SamplerState.PointClamp);
}
else
{
render.Clear(Color.Black);
render.RenderTextureComplete(render[PrincipalConstants.CurrentImage], Color.White, ginfo.FullScreenRectangle, Matrix.Identity, null, true, SpriteSortMode.Deferred, ginfo.SamplerState);
}
}
render.RenderPosComponents(gameTime, ref view, ref projection);
if (desc.DefferedDebug)
{
render.Clear(Color.Black);
if (desc.UseFloatingBufferForLightMap)
render.RenderBegin(Matrix.Identity,null,SpriteSortMode.Immediate,SamplerState.PointClamp);
else
render.RenderBegin(Matrix.Identity, null, SpriteSortMode.Immediate, ginfo.SamplerState);
render.RenderTexture(render[desc.RenderTargetsNameToDefferedDebug[0]] ,Color.White, new Rectangle(0, 0, halfWidth, halfHeight));
render.RenderTexture(render[desc.RenderTargetsNameToDefferedDebug[1]], Color.White, new Rectangle(0, halfHeight, halfWidth, halfHeight));
render.RenderTexture(render[desc.RenderTargetsNameToDefferedDebug[2]], Color.White, new Rectangle(halfWidth, 0, halfWidth, halfHeight));
render.RenderTexture(render[desc.RenderTargetsNameToDefferedDebug[3]], Color.White, new Rectangle(halfWidth, halfHeight, halfWidth, halfHeight));
render.RenderEnd();
}
}
else
{
render.RenderPosComponents(gameTime, ref view, ref projection);
}
render.ValidateSamplerStates();
}