本文整理汇总了C#中Mesh.Draw方法的典型用法代码示例。如果您正苦于以下问题:C# Mesh.Draw方法的具体用法?C# Mesh.Draw怎么用?C# Mesh.Draw使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mesh
的用法示例。
在下文中一共展示了Mesh.Draw方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DrawBatch
private void DrawBatch(Mesh mesh)
{
(mesh.Effect as InstancedBlackHoleEffect).SetInstanceData(this.InstanceData);
mesh.Draw();
}
示例2: ClearDepth
private void ClearDepth(Mesh mesh)
{
bool depthWrites = mesh.DepthWrites;
ColorWriteChannels colorWriteChannels = GraphicsDeviceExtensions.GetBlendCombiner(this.GraphicsDevice).ColorWriteChannels;
mesh.DepthWrites = true;
GraphicsDeviceExtensions.SetColorWriteChannels(this.GraphicsDevice, ColorWriteChannels.None);
mesh.AlwaysOnTop = true;
mesh.Position += this.CameraManager.InverseView.Forward * 2f;
mesh.Draw();
mesh.AlwaysOnTop = false;
mesh.Position -= this.CameraManager.InverseView.Forward * 2f;
GraphicsDeviceExtensions.SetColorWriteChannels(this.GraphicsDevice, colorWriteChannels);
mesh.DepthWrites = depthWrites;
}
示例3: Main
//.........这里部分代码省略.........
window.AddPostProcessingEffect(new BlackBands());
window.AddPostProcessingEffect(new RedBands());
// insert a postprocessing effect at the specific position
window.SetPostProcessingEffect(1, new WASDEffect());
window.SetPostProcessingEffect(1, new WobbleEffect(5));
Tilemap tileMap = new Tilemap("Assets/map001.csv", "Assets/tiles_spritesheet.png");
while (window.opened)
{
if (window.GetKey(KeyCode.Right))
{
tileMap.position += new Vector2(1, 0) * window.deltaTime * 300;
}
if (window.GetKey(KeyCode.Left))
{
tileMap.position += new Vector2(-1, 0) * window.deltaTime * 300;
}
if (window.GetKey(KeyCode.Up))
{
tileMap.position += new Vector2(0, -1) * window.deltaTime * 300;
}
if (window.GetKey(KeyCode.Down))
{
tileMap.position += new Vector2(0, 1) * window.deltaTime * 300;
}
tileMap.position += window.JoystickAxisRight(0) * window.deltaTime * 300;
tileMap.Draw();
for (int i = 0; i < tiles2.Instances; i++)
{
tiles2.SetPosition(i, new Vector2(20 * i, 20 * i), true);
if (i % 2 == 0)
{
tiles2.SetAdditiveColor(i, new Vector4(1, -1, -1, 1), true);
}
}
tiles2.UpdatePositions();
tiles2.UpdateAdditiveColors();
ship.position.Y = 10;
ship.position += new Vector2(5f, 0) * window.deltaTime;
ship.scale = new Vector2(1f, 1f);
t += window.deltaTime;
if (t > 1f / 24f)
{
index++;
if (index >= 51)
index = 0;
t = 0;
}
int x = (index % 10) * (alien.Width / 10);
int y = (index / 10) * height;
ship.DrawTexture(alien, x, y, alien.Width / 10, height);
square.DrawSolidColor(1f, 0, 0, 0.5f);