예제 #1
0
        /// <summary>
        /// Builds the heightfield data by using a callback to determine the height of the
        /// field elements.
        /// </summary>
        /// <param name="callback">The function which will determine the height data.</param>
        /// <param name="width">The total width of the heightfield along the local x axis.</param>
        /// <param name="depth">The total depth of the heightfield along the local z axis.</param>
        /// <param name="widthSamples">
        /// The number of vertices to sample along the width of the heightfield.
        /// </param>
        /// <param name="depthSamples">
        /// The number of vertices to sample along the depth of the heightfield.
        /// </param>
        /// <param name="scale">A uniform scale applied to all raw height data.</param>
        /// <param name="offset">An offset applied to the scaled height data.</param>
        /// <param name="thickness">
        /// A value subtracted from the lowest height which in effect adds an
        /// additional cuboid to the base of the heightfield. This is used to
        /// prevent geoms from looping under the desired terrain and not registering
        /// as a collision. Note that the thickness is not affected by the scale or
        /// offset parameters.
        /// </param>
        /// <param name="wrap">
        /// If <b>true</b> then the heightfield will infinitely tile in both directions
        /// along the local x and z axes. Otherwise, the heightfield is bounded from
        /// zero to <paramref name="width"/> in the local x axis, and zero to
        /// <paramref name="depth"/> in the local z axis.
        /// </param>
        public void BuildCallback(
            HeightfieldGetHeight callback,
            dReal width, dReal depth, int widthSamples, int depthSamples,
            dReal scale, dReal offset, dReal thickness, bool wrap)
        {
            if (callback == null)
            {
                throw new ArgumentNullException("callback");
            }

            NativeMethods.dGeomHeightfieldDataBuildCallback(
                id, IntPtr.Zero, (data, x, z) => callback(x, z),
                width, depth, widthSamples, depthSamples,
                scale, offset, thickness, wrap ? 1 : 0);
        }
예제 #2
0
 public static extern void GeomHeightfieldDataBuildCallback(IntPtr d, IntPtr pUserData, HeightfieldGetHeight pCallback,
     dReal width, dReal depth, int widthSamples, int depthSamples,
     dReal scale, dReal offset, dReal thickness, int bWrap);
예제 #3
0
 internal static extern void GeomHeightfieldDataBuildCallback(IntPtr d, IntPtr pUserData,
     HeightfieldGetHeight pCallback,
     Single width, Single depth, int widthSamples,
     int depthSamples,
     Single scale, Single offset, Single thickness, int bWrap);