public override double NodeLodBlend(TerrainTreeNode node, double distance)
        {
            double next = TriggerDistance(node.Lod);

            if (distance < next)
                return 1;
            double previous = TriggerDistance(node.Lod + 1);

            return 1 - (distance - next) / (previous - next);
        }
Пример #2
0
        public override double NodeLodBlend(TerrainTreeNode node, double distance)
        {
            double next = TriggerDistance(node.Lod);

            if (distance < next)
            {
                return(1);
            }
            double previous = TriggerDistance(node.Lod + 1);

            return(1 - (distance - next) / (previous - next));
        }
        internal PlanarTerrainBlock(PlanarTerrain terrain, Vector2i blockIndex)
        {
            this.terrain = terrain;
            this.blockIndex = blockIndex;

            int size = terrain.BlockSize;

            //heightTexture = new Texture2D(device, size, size, true, Format.Single, DepthFormat.None, 0, RenderTargetUsage.PlatformContents);
            //heightBackBuffer = new Texture2D(device, size, size, true, Format.Single, DepthFormat.None, 0, RenderTargetUsage.PlatformContents);

            treeRoot = new TerrainTreeNode(this, new Vector2i(0, 0), size, terrain.DeepestLod);
            DirtyTreeArea = new Box2i(0, 0, size, size);
        }
Пример #4
0
        protected TAttachedNode GetAttachment(TerrainTreeNode node)
        {
            TAttachedNode result;

            if (!Attachments.TryGetValue(node, out result))
            {
                result = Attachments[node] = new TAttachedNode()
                {
                    Module = (TModule)this, Node = node
                }
            }
            ;
            return(result);
        }
    }
Пример #5
0
 public override Containment NodeClip(TerrainTreeNode node)
 {
     return(node.pBox.Intersect(Frustum));
 }
Пример #6
0
 /// <summary>
 /// Clip the node using the clipping function.
 /// </summary>
 /// <param name="node">The node to clip.</param>
 /// <returns>Whether the node is outside, intersects with, or is inside the clipping range.</returns>
 public abstract override Containment NodeClip(TerrainTreeNode node);
Пример #7
0
 /// <summary>
 /// Return whether the node is contained in this module's clipping range.
 /// If this returns <see cref="Containment.Contains"/>, then any node with a smaller
 /// box must also be contained.
 /// </summary>
 /// <param name="node"></param>
 /// <returns></returns>
 public virtual Containment NodeClip(TerrainTreeNode node)
 {
     throw new NotImplementedException();
 }
Пример #8
0
 /// <summary>
 /// Return how much to blend between this LOD level and the next less detailed one.
 /// If this returns 1, then the node should be divided if possible.
 /// </summary>
 /// <param name="node"></param>
 /// <param name="distance"></param>
 /// <returns></returns>
 public virtual double NodeLodBlend(TerrainTreeNode node, double distance)
 {
     throw new NotImplementedException();
 }
 public override Containment NodeClip(TerrainTreeNode node)
 {
     return node.pBox.Intersect(Frustum);
 }
 /// <summary>
 /// Clip the node using the clipping function.
 /// </summary>
 /// <param name="node">The node to clip.</param>
 /// <returns>Whether the node is outside, intersects with, or is inside the clipping range.</returns>
 public abstract override Containment NodeClip(TerrainTreeNode node);
Пример #11
0
 /// <summary>Get the level-of-detail blending for the given <see cref="TerrainTreeNode"/>.</summary>
 /// <param name="node">The <see cref="TerrainTreeNode"/> to test.</param>
 /// <param name="distance">The distance to the <see cref="TerrainTreeNode"/>.</param>
 /// <returns>The level-of-detail blending.</returns>
 public override double NodeLodBlend(TerrainTreeNode node, double distance)
 {
     return(GetAttachment(node).LodBlend(distance));
 }