コード例 #1
0
        /// <summary>
        /// Adjusts the height of the specified vertex, updating the terrain.
        /// </summary>
        /// <param name="vert">The adjusted vertex.</param>
        /// <param name="h">The height that will be added.</param>
        public void AdjustVertexHeight(GridVertex vert, float h)
        {
            HeightMap[vert.U, vert.V]          += h;
            Body.Shape.Heights[vert.U, vert.V] += h;
            int     index = ((vert.U - 1) * Size + vert.V) * 3;
            int     s3    = Size * 3;
            Vector3 point = vert.ToCartesianCoords3D(HeightMap);

            Builder.Vertices[index - s3 - 1] = point;
            Builder.Vertices[index - 3]      = point;
            Builder.Vertices[index + s3 - 2] = point;
            Builder.Vertices[index - s3 + 1] = point;
            Builder.Vertices[index]          = point;
            Builder.Vertices[index + s3 + 2] = point;
            Rend.GenerateVBO(Builder);
        }