Beispiel #1
0
        public TerrainNode(Terrain terrain, Material material)
        {
            if (terrain == null)
            {
                throw new ArgumentNullException("terrain");
            }
            if (material == null)
            {
                throw new ArgumentNullException("material");
            }

            Terrain  = terrain;
            Material = material;

            IsRenderable = true;
            CastsShadows = true;
            Shape        = terrain.Shape;

            _baseClipmap = new TerrainClipmap(1, SurfaceFormat.HalfVector4)
            {
                LevelBias = 0.1f,
            };

            _detailClipmap = new TerrainClipmap(3, SurfaceFormat.Color)
            {
                CellsPerLevel  = 1024,
                NumberOfLevels = 6,
            };
            DetailClipmap.CellSizes[0] = 0.005f;
            DetailClipmap.Invalidate();

            HoleThreshold   = 0.3f;
            DetailFadeRange = 0.3f;
        }
Beispiel #2
0
        /// <inheritdoc/>
        protected override void Dispose(bool disposing, bool disposeData)
        {
            if (!IsDisposed)
            {
                if (disposing)
                {
                    BaseClipmap.Dispose();
                    DetailClipmap.Dispose();
                    Shape = Shape.Empty;

                    if (disposeData)
                    {
                        Terrain.Dispose();
                    }
                }

                base.Dispose(disposing, disposeData);
            }
        }