protected void DrawElement(TerrainRenderElement element) { for (int j = element.clips.Length - 1; j >= 0; j--) { bool isVisible = (renderView.GetFrustum().Contains(element.clips[j].Bounds) != ContainmentType.Disjoint || element.clips[j].Bounds.Contains(renderView.GetPosition()) != ContainmentType.Disjoint); if (element.clips[j].Triangles > 0 && isVisible) { GFX.Device.SetVertexShaderConstant(GFXShaderConstants.VC_USERDEF0, new Vector4(element.N, element.clips[j].FactorG, element.CameraPos.X, element.CameraPos.Z)); GFX.Device.DrawUserIndexedPrimitives(PrimitiveType.TriangleStrip, element.clips[j].Vertices, 0, element.clips[j].Vertices.Length, element.clips[j].Indices, 0, element.clips[j].Triangles); } } }
void BuildTerrain() { terrainMaterial = ResourceManager.Inst.GetMaterial("NULL"); Texture2D[] blendTextures = new Texture2D[blendMaps.Length]; for(int i = 0; i < blendTextures.Length; i++) blendTextures[i] = blendMaps[i].GetTexture(); clips = new Clipmap[L]; for (int i = 0; i < L; i++) clips[i] = new Clipmap(i, this); terrainElement = new TerrainRenderElement(); terrainElement.clips = clips; terrainElement.N = this.N; terrainElement.BlendMaps = blendTextures; terrainElement.NormalMap = normalTexture; }
public virtual void AddElement(TerrainClimate climate, TerrainRenderElement element) { }
public override void AddElement(TerrainClimate climate, TerrainRenderElement element) { Elements.Enqueue(element); }
public override void AddElement(TerrainClimate climate, TerrainRenderElement element) { if (!Elements.ContainsKey(climate)) Elements.Add(climate, new Queue<TerrainRenderElement>()); Elements[climate].Enqueue(element); }