public void Execute(TerrainGeometrySurface surface, TerrainNodeBounds bounds) { surface.Begin(); surface.Clear(); //device.VertexDeclaration = vertexPositionTexture; // disable depth buffer and alpha blending device.DepthStencilState = DepthStencilState.None; device.BlendState = BlendState.Opaque; generateTerrainEffect.Parameters["PermutationMap"].SetValue(permutationTexture); generateTerrainEffect.Parameters["GradientMap"].SetValue(gradientTexture); generateTerrainEffect.Parameters["PatchLeft"].SetValue((float)bounds.Left); generateTerrainEffect.Parameters["PatchTop"].SetValue((float)bounds.Top); generateTerrainEffect.Parameters["PatchWidth"].SetValue((float)bounds.Width); generateTerrainEffect.Parameters["PatchHeight"].SetValue((float)bounds.Height); generateTerrainEffect.Parameters["FaceMatrix"].SetValue(CubeFaces.GetFace(bounds.Face).FaceMatrix); for (int i = 0; i < generateTerrainEffect.CurrentTechnique.Passes.Count; i++) { EffectPass pass = generateTerrainEffect.CurrentTechnique.Passes[i]; pass.Apply(); device.DrawUserPrimitives(PrimitiveType.TriangleStrip, surface.Vertices, 0, 2); } surface.End(); }
public void Execute(TerrainGeometrySurface surface, TerrainNodeBounds bounds) { surface.Begin(); surface.Clear(); // disable depth buffer and alpha blending device.DepthStencilState = DepthStencilState.None; device.BlendState = BlendState.Opaque; for (int i = 0; i < generateTerrainEffect.CurrentTechnique.Passes.Count; i++) { EffectPass pass = generateTerrainEffect.CurrentTechnique.Passes[i]; pass.Apply(); device.DrawUserPrimitives(PrimitiveType.TriangleStrip, surface.Vertices, 0, 2); } surface.End(); }