本文整理汇总了C#中Microsoft.Xna.Framework.Graphics.DepthStencilState类的典型用法代码示例。如果您正苦于以下问题:C# DepthStencilState类的具体用法?C# DepthStencilState怎么用?C# DepthStencilState使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DepthStencilState类属于Microsoft.Xna.Framework.Graphics命名空间,在下文中一共展示了DepthStencilState类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Draw
public void Draw(Matrix currentViewMatrix, Matrix currentProjection)
{
dsState = new DepthStencilState();
dsState.DepthBufferWriteEnable = false;
device.DepthStencilState = dsState;
Matrix[] modelTransforms = new Matrix[model.Bones.Count];
model.CopyAbsoluteBoneTransformsTo(modelTransforms);
Matrix wMatrix = Matrix.CreateTranslation(translation) * Matrix.CreateScale(scale); //* Matrix.CreateTranslation(theCamera.CamPos)
foreach (ModelMesh mesh in model.Meshes)
{
foreach (Effect currentEffect in mesh.Effects)
{
Matrix worldMatrix = modelTransforms[mesh.ParentBone.Index] * wMatrix;
currentEffect.CurrentTechnique = currentEffect.Techniques["Textured"];
currentEffect.Parameters["xWorld"].SetValue(worldMatrix);
currentEffect.Parameters["xView"].SetValue(currentViewMatrix);
currentEffect.Parameters["xProjection"].SetValue(currentProjection);
currentEffect.Parameters["xTexture1"].SetValue(texture);
currentEffect.Parameters["xEnableLighting"].SetValue(false);
}
mesh.Draw();
}
dsState = new DepthStencilState();
dsState.DepthBufferWriteEnable = true;
device.DepthStencilState = dsState;
}
开发者ID:oxycoon,项目名称:Cubes,代码行数:28,代码来源:SkyDome.cs
示例2: DrawSkybox
private void DrawSkybox()
{
SamplerState ss = new SamplerState();
ss.AddressU = TextureAddressMode.Clamp;
ss.AddressV = TextureAddressMode.Clamp;
Engine.Video.GraphicsDevice.SamplerStates[0] = ss;
DepthStencilState dss = new DepthStencilState();
dss.DepthBufferEnable = false;
Engine.Video.GraphicsDevice.DepthStencilState = dss;
Matrix[] skyboxTransforms = new Matrix[skyboxModel.Bones.Count];
skyboxModel.CopyAbsoluteBoneTransformsTo(skyboxTransforms);
int i = 0;
foreach(ModelMesh mesh in skyboxModel.Meshes) {
foreach(Effect currentEffect in mesh.Effects) {
Matrix worldMatrix = skyboxTransforms[mesh.ParentBone.Index];
currentEffect.CurrentTechnique = currentEffect.Techniques["Textured"];
currentEffect.Parameters["xWorld"].SetValue(worldMatrix);
currentEffect.Parameters["xView"].SetValue(camera.ViewMatrix);
currentEffect.Parameters["xProjection"].SetValue(camera.ProjectionMatrix);
currentEffect.Parameters["xTexture"].SetValue(skyboxTextures[i++]);
}
mesh.Draw();
}
dss = new DepthStencilState();
dss.DepthBufferEnable = true;
Engine.Video.GraphicsDevice.DepthStencilState = dss;
}
开发者ID:PhoenixWright,项目名称:Mystery,代码行数:33,代码来源:Skybox.cs
示例3: Draw
public override void Draw(GameTime gameTime)
{
DepthStencilState s = new DepthStencilState();
s.DepthBufferWriteEnable = false;
DepthStencilState bak = device.DepthStencilState;
device.DepthStencilState = s;
device.RasterizerState = new RasterizerState() { CullMode = CullMode.None, FillMode = FillMode.Solid };
Matrix wMatrix = Matrix.CreateScale(scale) * Matrix.CreateTranslation(cameraPosition);
effect.CurrentTechnique = effect.Techniques["SkyBox"];
effect.Parameters["xView"].SetValue(viewMatrix);
effect.Parameters["xProjection"].SetValue(projectionMatrix);
effect.Parameters["xWorld"].SetValue(wMatrix);
effect.Parameters["xCamPos"].SetValue(cameraPosition);
effect.Parameters["xSkyBoxTexture"].SetValue(cloudMap);
effect.Parameters["xEnableLighting"].SetValue(false);
effect.Parameters["xClipping"].SetValue(false);
effect.Parameters["xTexture"].SetValue(Tools.Quick.biomeTextures[1]);
foreach (EffectPass pass in effect.CurrentTechnique.Passes)
{
pass.Apply();
device.SetVertexBuffer(vertexBuffer);
device.Indices = indexBuffer;
device.DrawIndexedPrimitives(PrimitiveType.TriangleList, 0, 0, indexBuffer.IndexCount, 0, indexBuffer.IndexCount / 3);
}
device.DepthStencilState = bak;
base.Draw(gameTime);
}
开发者ID:Jupotter,项目名称:Nameless-Tales,代码行数:30,代码来源:Skybox.cs
示例4: draw
public void draw(Matrix view, Matrix projection, Vector3 playerPosition)
{
SamplerState samplerState = new SamplerState();
samplerState.AddressU = TextureAddressMode.Clamp;
samplerState.AddressV = TextureAddressMode.Clamp;
Game1.getGraphics().GraphicsDevice.SamplerStates[0] = samplerState;
DepthStencilState dss = new DepthStencilState();
dss.DepthBufferEnable = false;
Game1.getGraphics().GraphicsDevice.DepthStencilState = dss;
Matrix[] skyboxTransforms = new Matrix[skyboxModel.Bones.Count];
skyboxModel.CopyAbsoluteBoneTransformsTo(skyboxTransforms);
foreach (ModelMesh mesh in skyboxModel.Meshes)
{
foreach (BasicEffect effect in mesh.Effects)
{
Matrix worldMatrix = skyboxTransforms[mesh.ParentBone.Index] * Matrix.CreateTranslation(playerPosition);
//effect.CurrentTechnique = effect.Techniques["Textured"];
effect.LightingEnabled = true;
effect.AmbientLightColor = new Vector3(1f, 1f, 1f);
effect.EmissiveColor = new Vector3(0.4f, 0.4f, 0.4f);
effect.TextureEnabled = true;
effect.Texture = skyboxTextures;
effect.World = worldMatrix;
effect.View = view;
effect.Projection = projection;
}
mesh.Draw();
}
dss = new DepthStencilState();
dss.DepthBufferEnable = true;
Game1.getGraphics().GraphicsDevice.DepthStencilState = dss;
}
开发者ID:tobeneck,项目名称:WitchMaze,代码行数:35,代码来源:Skybox.cs
示例5: Draw
/// <summary>
/// This is called when the game should draw itself.
/// </summary>
/// <param name="gameTime">Provides a snapshot of timing values.</param>
protected override void Draw(GameTime gameTime)
{
renderer.matrix = Matrix.CreateTranslation(0, 0, 0);
GraphicsDevice.Clear(Color.Black);
Vector3 cameraPosition = new Vector3(0, 0, 2.5f);
cameraPosition.Y -= .01f;
if (target == null)
{
//Uncomment for depth correction; but blurry pictures
//target = new RenderTarget2D(GraphicsDevice, GraphicsDevice.PresentationParameters.BackBufferWidth, GraphicsDevice.PresentationParameters.BackBufferHeight,false,SurfaceFormat.Rgba64,DepthFormat.Depth24);
target = new RenderTarget2D(GraphicsDevice, GraphicsDevice.PresentationParameters.BackBufferWidth, GraphicsDevice.PresentationParameters.BackBufferHeight);
} RasterizerState tstate = new RasterizerState();
tstate.CullMode = CullMode.None;
DepthStencilState lstate = new DepthStencilState();
GraphicsDevice.SamplerStates[0] = SamplerState.LinearClamp;
lstate.DepthBufferEnable = true;
GraphicsDevice.DepthStencilState = lstate;
GraphicsDevice.RasterizerState = tstate;
if (!renderer.NtfyReadyRender(GraphicsDevice))
{
renderer.NtfyReadyRender(GraphicsDevice);
}
base.Draw(gameTime);
}
开发者ID:IDWMaster,项目名称:3DAPI,代码行数:33,代码来源:Game1.cs
示例6: RenderManager
internal RenderManager(GraphicsDevice device)
{
Skins = new Dictionary<string, Skin>();
Texts = new Dictionary<string, Text>();
ApplyStencil = new DepthStencilState {
StencilEnable = true,
StencilFunction = CompareFunction.Always,
StencilPass = StencilOperation.Replace,
ReferenceStencil = 1,
DepthBufferEnable = false,
};
SampleStencil = new DepthStencilState {
StencilEnable = true,
StencilFunction = CompareFunction.Equal,
StencilPass = StencilOperation.Keep,
ReferenceStencil = 1,
DepthBufferEnable = false,
};
GraphicsDevice = device;
RasterizerState = new RasterizerState { ScissorTestEnable = true };
SpriteBatch = new SpriteBatch(GraphicsDevice);
}
开发者ID:yadiate,项目名称:MonoGameGui,代码行数:25,代码来源:RenderManager.cs
示例7: Draw
Texture2D[] skyboxTextures; // textures to display around the skybox
#endregion Fields
#region Methods
/// <summary>
/// Draw the skybox to the screen.
/// </summary>
/// <param name="device"></param>
/// <param name="gameCamera">Used to get the view and projection matrices</param>
/// <param name="player">The player's position governs where the skybox is drawn</param>
public void Draw(ref GraphicsDevice device, Camera gameCamera, Player player)
{
device.SamplerStates[0] = clampTextureAddressMode;
DepthStencilState dss = new DepthStencilState();
dss.DepthBufferEnable = false;
device.DepthStencilState = dss;
Matrix[] skyboxTransforms = new Matrix[skyboxModel.Bones.Count];
skyboxModel.CopyAbsoluteBoneTransformsTo(skyboxTransforms);
int i = 0;
foreach (ModelMesh mesh in skyboxModel.Meshes)
{
foreach (Effect currentEffect in mesh.Effects)
{
Matrix worldMatrix = skyboxTransforms[mesh.ParentBone.Index] * Matrix.CreateTranslation(player.Position);
currentEffect.CurrentTechnique = currentEffect.Techniques["Textured"];
currentEffect.Parameters["xWorld"].SetValue(worldMatrix);
currentEffect.Parameters["xView"].SetValue(gameCamera.ViewMatrix);
currentEffect.Parameters["xProjection"].SetValue(gameCamera.ProjectionMatrix);
currentEffect.Parameters["xTexture"].SetValue(skyboxTextures[i++]);
}
mesh.Draw();
}
dss = new DepthStencilState();
dss.DepthBufferEnable = true;
device.DepthStencilState = dss;
}
开发者ID:jaruchti,项目名称:3DGame-Programming,代码行数:41,代码来源:Skybox.cs
示例8: EffectState
public EffectState(Effect effect, SamplerState sampler, RasterizerState raster, DepthStencilState stencil, bool texture)
{
Effect = effect;
Sampler = sampler;
Raster = raster;
TextureOverride = texture;
}
开发者ID:ZaneDubya,项目名称:YCPU,代码行数:7,代码来源:EffectState.cs
示例9: ImperativeRenderer
public ImperativeRenderer(
IBatchContainer container,
DefaultMaterialSet materials,
int layer = 0,
RasterizerState rasterizerState = null,
DepthStencilState depthStencilState = null,
BlendState blendState = null,
SamplerState samplerState = null,
bool worldSpace = true,
bool useZBuffer = false,
bool autoIncrementSortKey = false,
bool autoIncrementLayer = false
)
{
if (container == null)
throw new ArgumentNullException("container");
if (materials == null)
throw new ArgumentNullException("materials");
Container = container;
Materials = materials;
Layer = layer;
RasterizerState = rasterizerState;
DepthStencilState = depthStencilState;
BlendState = blendState;
SamplerState = samplerState;
UseZBuffer = useZBuffer;
WorldSpace = worldSpace;
AutoIncrementSortKey = autoIncrementSortKey;
AutoIncrementLayer = autoIncrementLayer;
NextSortKey = 0;
PreviousBatch = null;
}
开发者ID:pakoito,项目名称:Fracture,代码行数:33,代码来源:Convenience.cs
示例10: Initialize
/// <summary>
/// Allows the game to perform any initialization it needs to before starting to run.
/// This is where it can query for any required services and load any non-graphic
/// related content. Calling base.Initialize will enumerate through any components
/// and initialize them as well.
/// </summary>
protected override void Initialize()
{
// TODO: Add your initialization logic here
input = new Input();
GraphicsDevice.BlendState = BlendState.AlphaBlend;
dpsLockDepthWrite = new DepthStencilState();
dpsLockDepthWrite.DepthBufferWriteEnable = false;
DepthStencilState dpsUnLockDepthWrite = new DepthStencilState();
dpsUnLockDepthWrite.DepthBufferWriteEnable = true;
//graphics.PreferredBackBufferWidth = 1280;
//graphics.PreferredBackBufferHeight = 720;
//b = new Bat(-11f, Vector3.UnitZ, Vector3.Up, 0.9f, 0.9f, 0.9f, Color.Gray, graphics);
myCamera = new CameraComponent(graphics);
//model = new GameModel(this, Content, myCamera, Matrix.Identity, e, "box");
//Components.Add(model);
float width = 2.0f;
float height = 1.2f;
tunnel = new Tunnel(this, graphics, myCamera, Content, 1, 15, Vector3.Zero, Vector3.Backward, Vector3.Up, width, height);
frontBat = new Bat(-2.0f, Vector3.Backward, Vector3.Up, .2f, .2f, Color.Red, myCamera, graphics, width, height);
backBat = new Bat(-15.0f, Vector3.Backward, Vector3.Up, .2f, .2f, Color.Green, myCamera, graphics, width, height);
Components.Add(tunnel);
base.Initialize();
}
开发者ID:Riziero,项目名称:Pong3D,代码行数:34,代码来源:Game1.cs
示例11: DrawSkybox
public void DrawSkybox(Camera camera, Vector3 shipPosition)
{
//A TextureAddressMode.Clamp state removes the seams between the cube.
SamplerState ss = new SamplerState();
ss.AddressU = TextureAddressMode.Clamp;
ss.AddressV = TextureAddressMode.Clamp;
_device.SamplerStates[0] = ss;
//Removes the ZBuffer so no size can be set for the skybox.
DepthStencilState dss = new DepthStencilState();
dss.DepthBufferEnable = false;
_device.DepthStencilState = dss;
Matrix[] transforms = new Matrix[_skyboxModel.Bones.Count]; //Represents the position of each model bone.
_skyboxModel.CopyAbsoluteBoneTransformsTo(transforms); //Models have a method that populates an array.
foreach (ModelMesh mesh in _skyboxModel.Meshes)
{
//BasicEffect is a simplified version of it's parent class Effect. Effects allow objects to be placed on screen.
foreach (BasicEffect basicEffect in mesh.Effects)
{
basicEffect.Projection = camera.Projection;
basicEffect.View = camera.View;
basicEffect.World = Matrix.CreateScale(80) * mesh.ParentBone.Transform * Matrix.CreateTranslation(shipPosition); //Positions the mesh in the correct place relavent to the world.
}
mesh.Draw();
}
//Reenabling the ZBuffer.
dss = new DepthStencilState();
dss.DepthBufferEnable = true;
_device.DepthStencilState = dss;
}
开发者ID:robertg,项目名称:Soar,代码行数:34,代码来源:Skybox.cs
示例12: EffectApplication
static EffectApplication()
{
sDSStateSky = new DepthStencilState();
sDSStateSky.DepthBufferFunction = CompareFunction.LessEqual;
sRenderStateBlendStateMap = new Dictionary<RenderStatePresets, BlendState>();
sRenderStateBlendStateMap.Add(RenderStatePresets.Default, BlendState.Opaque);
sRenderStateBlendStateMap.Add(RenderStatePresets.AlphaAdd, BlendState.Additive);
sRenderStateBlendStateMap.Add(RenderStatePresets.AlphaBlend, BlendState.AlphaBlend);
sRenderStateBlendStateMap.Add(RenderStatePresets.AlphaBlendNPM, BlendState.NonPremultiplied);
sRenderStateBlendStateMap.Add(RenderStatePresets.Skybox, BlendState.Opaque);
sRenderStateDepthStencilStateMap = new Dictionary<RenderStatePresets, DepthStencilState>();
sRenderStateDepthStencilStateMap.Add(RenderStatePresets.Default, DepthStencilState.Default);
sRenderStateDepthStencilStateMap.Add(RenderStatePresets.AlphaAdd, DepthStencilState.DepthRead);
sRenderStateDepthStencilStateMap.Add(RenderStatePresets.AlphaBlend, DepthStencilState.DepthRead);
sRenderStateDepthStencilStateMap.Add(RenderStatePresets.AlphaBlendNPM, DepthStencilState.DepthRead);
sRenderStateDepthStencilStateMap.Add(RenderStatePresets.Skybox, sDSStateSky);
sRenderStateRasterizerStateMap = new Dictionary<RenderStatePresets, RasterizerState>();
sRenderStateRasterizerStateMap.Add(RenderStatePresets.Default, RasterizerState.CullCounterClockwise);
sRenderStateRasterizerStateMap.Add(RenderStatePresets.AlphaAdd, RasterizerState.CullNone);
sRenderStateRasterizerStateMap.Add(RenderStatePresets.AlphaBlend, RasterizerState.CullCounterClockwise);
sRenderStateRasterizerStateMap.Add(RenderStatePresets.AlphaBlendNPM, RasterizerState.CullCounterClockwise);
sRenderStateRasterizerStateMap.Add(RenderStatePresets.Skybox, RasterizerState.CullNone);
sRenderStateAlphaPassMap = new Dictionary<RenderStatePresets, bool>();
sRenderStateAlphaPassMap.Add(RenderStatePresets.Default, false);
sRenderStateAlphaPassMap.Add(RenderStatePresets.AlphaAdd, true);
sRenderStateAlphaPassMap.Add(RenderStatePresets.AlphaBlend, true);
sRenderStateAlphaPassMap.Add(RenderStatePresets.AlphaBlendNPM, true);
sRenderStateAlphaPassMap.Add(RenderStatePresets.Skybox, false);
}
开发者ID:Tengato,项目名称:Mechadrone1,代码行数:33,代码来源:EffectApplication.cs
示例13: CreateInstancedRequest
public IRenderRequest CreateInstancedRequest(IRenderContext renderContext, RasterizerState rasterizerState,
BlendState blendState, DepthStencilState depthStencilState, IEffect effect, IEffectParameterSet effectParameterSet,
VertexBuffer meshVertexBuffer, IndexBuffer meshIndexBuffer, PrimitiveType primitiveType,
Matrix[] instanceWorldTransforms, Action<List<Matrix>, VertexBuffer, IndexBuffer> computeCombinedBuffers)
{
throw new NotImplementedException();
}
开发者ID:RedpointGames,项目名称:Protogame,代码行数:7,代码来源:NullRenderBatcher.cs
示例14: Draw
/// <summary>
/// Does the actual drawing of the skybox with our skybox effect.
/// There is no world matrix, because we're assuming the skybox won't
/// be moved around. The size of the skybox can be changed with the size
/// variable.
/// </summary>
/// <param name="view">The view matrix for the effect</param>
/// <param name="projection">The projection matrix for the effect</param>
/// <param name="cameraPosition">The position of the camera</param>
public override void Draw(GameTime gameTime)
{
GraphicsDevice device = game.GraphicsDevice;
SamplerState ss = new SamplerState();
ss.AddressU = TextureAddressMode.Clamp;
ss.AddressV = TextureAddressMode.Clamp;
device.SamplerStates[0] = ss;
DepthStencilState dss = new DepthStencilState();
dss.DepthBufferEnable = false;
device.DepthStencilState = dss;
Matrix[] skyboxTransforms = new Matrix[skyboxModel.Bones.Count];
skyboxModel.CopyAbsoluteBoneTransformsTo(skyboxTransforms);
int i = 0;
foreach (ModelMesh mesh in skyboxModel.Meshes)
{
foreach (BasicEffect currentEffect in mesh.Effects)
{
Matrix worldMatrix = skyboxTransforms[mesh.ParentBone.Index] * Matrix.CreateTranslation(camera.position);
currentEffect.World = worldMatrix;
currentEffect.View = camera.view;
currentEffect.Projection = camera.projection;
currentEffect.TextureEnabled=true;
currentEffect.Texture = skyboxTextures[i++];
}
mesh.Draw();
}
dss = new DepthStencilState();
dss.DepthBufferEnable = true;
device.DepthStencilState = dss;
}
开发者ID:ewencluley,项目名称:Space1939,代码行数:44,代码来源:Skybox.cs
示例15: Score
public Score(PuzzleBooble3dGame puzzlegame)
: base(puzzlegame)
{
DepthStateEnabled = new DepthStencilState();
DepthStateEnabled.DepthBufferEnable = true; /* Enable the depth buffer */
//depthState.DepthBufferWriteEnable = true; /* When drawing to the screen, write to the depth buffer */
}
开发者ID:rz-robsn,项目名称:PuzzleBooble3DClone,代码行数:7,代码来源:Score.cs
示例16: DrawClippedSky
public void DrawClippedSky(GraphicsDevice device, Effect effect, Camera camera)
{
DepthStencilState s = new DepthStencilState();
s.DepthBufferWriteEnable = false;
DepthStencilState bak = device.DepthStencilState;
device.DepthStencilState = s;
device.RasterizerState = new RasterizerState() { CullMode = CullMode.None, FillMode = FillMode.Solid };
Matrix wMatrix = Matrix.CreateScale(scale) * Matrix.CreateTranslation(camera.position);
effect.CurrentTechnique = effect.Techniques["SkyBox"];
effect.Parameters["xView"].SetValue(camera.getview());
effect.Parameters["xProjection"].SetValue(camera.GetProjection());
effect.Parameters["xWorld"].SetValue(wMatrix);
effect.Parameters["xCamPos"].SetValue(camera.position);
effect.Parameters["xSkyBoxTexture"].SetValue(cloudMap);
effect.Parameters["xEnableLighting"].SetValue(false);
//currentEffect.Parameters["xClipping"].SetValue(true);
foreach (EffectPass pass in effect.CurrentTechnique.Passes)
{
pass.Apply();
device.SetVertexBuffer(vertexBuffer);
device.Indices = indexBuffer;
device.DrawIndexedPrimitives(PrimitiveType.TriangleList, 0, 0, indexBuffer.IndexCount, 0, indexBuffer.IndexCount / 3);
}
device.DepthStencilState = bak;
}
开发者ID:Jupotter,项目名称:Nameless-Tales,代码行数:29,代码来源:Skybox.cs
示例17: LoadContent
protected override void LoadContent()
{
_adt = new ADT(_path);
_adt.Read();
_terrain = new GeometryDrawer();
_terrain.Initialize(Game, Color.Green, _adt.MapChunks.Select(mc => mc.Vertices),
_adt.MapChunks.Select(mc => mc.Triangles));
var firstVert = _adt.MapChunks[0].Vertices[0];
meshDisplay.Game.Camera.Camera.Position = new Vector3(firstVert.Y, firstVert.Z, firstVert.X);
if (_adt.DoodadHandler.Triangles != null)
{
_doodads = new GeometryDrawer();
_doodads.Initialize(Game, Color.Yellow, _adt.DoodadHandler.Vertices, _adt.DoodadHandler.Triangles);
}
if (_adt.WorldModelHandler.Triangles != null)
{
_wmos = new GeometryDrawer();
_wmos.Initialize(Game, Color.Red, _adt.WorldModelHandler.Vertices, _adt.WorldModelHandler.Triangles);
}
if (_adt.LiquidHandler.Triangles != null)
{
_liquid = new GeometryDrawer();
_liquid.Initialize(Game, Color.Blue, _adt.LiquidHandler.Vertices, _adt.LiquidHandler.Triangles);
}
_effect = new BasicEffect(GraphicsDevice);
_depthState = new DepthStencilState {DepthBufferEnable = true};
}
开发者ID:Bia10,项目名称:meshReader,代码行数:33,代码来源:AdtDrawer.cs
示例18: Draw
public override void Draw(GameTime gameTime)
{
var strings = new List<String>();
strings.Add(String.Format("Num blocks / vertices : {0} / {1}", _game.Map.NumBlocks, _game.Map.NumVertices));
strings.Add(String.Format("Player position : {0}, {1}, {2} ({3}, {4}, {5})",
_game.Player.MapPosition.X, _game.Player.MapPosition.Y, _game.Player.MapPosition.Z,
_game.Player.Position.X, _game.Player.Position.Y, _game.Player.Position.Z));
strings.Add(String.Format("Player block aim : {0}, {1}, {2}", _game.Player.BlockAim.X, _game.Player.BlockAim.Y, _game.Player.BlockAim.Z));
_game.SpriteBatch.Begin();
var height = 45;
foreach(var str in strings)
{
_game.SpriteBatch.DrawString(_font, str, new Vector2(20, height), Color.White);
height += 20;
}
_game.SpriteBatch.End();
base.Draw(gameTime);
var state = new DepthStencilState();
state.DepthBufferEnable = true;
_game.GraphicsDevice.DepthStencilState = state;
}
开发者ID:globeus,项目名称:worldcraft,代码行数:28,代码来源:DebugInfos.cs
示例19: Mask
public Mask(Sprite spriteMask, Sprite spriteTarget)
{
_spriteMask = spriteMask;
_spriteTarget = spriteTarget;
Render.Viewport.ResolutionChanged += Setup;
Setup();
_maskStencilState = new DepthStencilState
{
StencilEnable = true,
StencilFunction = CompareFunction.Always,
StencilPass = StencilOperation.Replace,
ReferenceStencil = 1,
DepthBufferEnable = false,
};
_targetStencilState = new DepthStencilState
{
StencilEnable = true,
StencilFunction = CompareFunction.LessEqual,
StencilPass = StencilOperation.Replace,
ReferenceStencil = 1,
DepthBufferEnable = false,
};
Add(new DrawComponent(Draw));
}
开发者ID:hgrandry,项目名称:Mgx,代码行数:28,代码来源:Mask.cs
示例20: EffectPass
internal EffectPass( Effect effect,
string name,
Shader vertexShader,
Shader pixelShader,
BlendState blendState,
DepthStencilState depthStencilState,
RasterizerState rasterizerState,
EffectAnnotationCollection annotations )
{
Debug.Assert(effect != null, "Got a null effect!");
Debug.Assert(annotations != null, "Got a null annotation collection!");
_effect = effect;
Name = name;
_vertexShader = vertexShader;
_pixelShader = pixelShader;
_blendState = blendState;
_depthStencilState = depthStencilState;
_rasterizerState = rasterizerState;
Annotations = annotations;
}
开发者ID:KennethYap,项目名称:MonoGame,代码行数:25,代码来源:EffectPass.cs
注:本文中的Microsoft.Xna.Framework.Graphics.DepthStencilState类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论