org.ode4j.ode
Interface DHeightfieldData


public interface DHeightfieldData


Method Summary
 void build(byte[] pHeightData, boolean bCopyHeightData, double width, double depth, int widthSamples, int depthSamples, double scale, double offset, double thickness, boolean bWrap)
          Configures a dHeightfieldData to use height data in byte format.
 void build(double[] pHeightData, boolean bCopyHeightData, double width, double depth, int widthSamples, int depthSamples, double scale, double offset, double thickness, boolean bWrap)
          Configures a dHeightfieldData to use height data in double precision floating point format.
 void build(float[] pHeightData, boolean bCopyHeightData, double width, double depth, int widthSamples, int depthSamples, double scale, double offset, double thickness, boolean bWrap)
          Configures a dHeightfieldData to use height data in single precision floating point format.
 void build(short[] pHeightData, boolean bCopyHeightData, double width, double depth, int widthSamples, int depthSamples, double scale, double offset, double thickness, boolean bWrap)
          Configures a dHeightfieldData to use height data in short format.
 void buildByte(byte[] pHeightData, boolean bCopyHeightData, double width, double depth, int widthSamples, int depthSamples, double scale, double offset, double thickness, boolean bWrap)
          Deprecated. Please use build(byte[], ...) instead.
 void buildCallback(java.lang.Object pUserData, DHeightfield.DHeightfieldGetHeight pCallback, double width, double depth, int widthSamples, int depthSamples, double scale, double offset, double thickness, boolean bWrap)
          Configures a dHeightfieldData to use a callback to retrieve height data.
 void destroy()
          Destroys a dHeightfieldData.
 void setBounds(double minHeight, double maxHeight)
          Manually set the minimum and maximum height bounds.
 

Method Detail

buildCallback

void buildCallback(java.lang.Object pUserData,
                   DHeightfield.DHeightfieldGetHeight pCallback,
                   double width,
                   double depth,
                   int widthSamples,
                   int depthSamples,
                   double scale,
                   double offset,
                   double thickness,
                   boolean bWrap)
Configures a dHeightfieldData to use a callback to retrieve height data.

Before a dHeightfieldData can be used by a geom it must be configured to specify the format of the height data. This call specifies that the heightfield data is computed by the user and it should use the given callback when determining the height of a given element of it's shape.

Parameters:
width - Specifies the total 'width' of the heightfield along the geom's local x axis.
depth - Specifies the total 'depth' of the heightfield along the geom's local z axis.
widthSamples - Specifies the number of vertices to sample along the width of the heightfield. Each vertex has a corresponding height value which forms the overall shape. Naturally this value must be at least two or more.
depthSamples - Specifies the number of vertices to sample along the depth of the heightfield.
scale - A uniform scale applied to all raw height data.
offset - An offset applied to the scaled height data.
thickness - A value subtracted from the lowest height value 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.
bWrap - If non-zero the heightfield will infinitely tile in both directions along the local x and z axes. If zero the heightfield is bounded from zero to width in the local x axis, and zero to depth in the local z axis.

destroy

void destroy()
Destroys a dHeightfieldData.

Deallocates a given dHeightfieldData and all managed resources.


setBounds

void setBounds(double minHeight,
               double maxHeight)
Manually set the minimum and maximum height bounds.

This call allows you to set explicit min / max values after initial creation typically for callback heightfields which default to +/- infinity, or those whose data has changed. This must be set prior to binding with a geom, as the the AABB is not recomputed after it's first generation.

Parameters:
minHeight - The new minimum height value. Scale, offset and thickness is then applied.
maxHeight - The new maximum height value. Scale and offset is then applied.
Remark:
The minimum and maximum values are used to compute the AABB for the heightfield which is used for early rejection of collisions. A close fit will yield a more efficient collision check.

build

void build(byte[] pHeightData,
           boolean bCopyHeightData,
           double width,
           double depth,
           int widthSamples,
           int depthSamples,
           double scale,
           double offset,
           double thickness,
           boolean bWrap)
Configures a dHeightfieldData to use height data in byte format.

Before a dHeightfieldData can be used by a geom it must be configured to specify the format of the height data. This call specifies that the heightfield data is stored as a rectangular array of bytes (8 bit unsigned) representing the height at each sample point.

See build(double[], ...) for example code.

Parameters:
pHeightData - A pointer to the height data.
bCopyHeightData - When non-zero the height data is copied to an internal store. When zero the height data is accessed by reference and so must persist throughout the lifetime of the heightfield.
width - Specifies the total 'width' of the heightfield along the geom's local x axis.
depth - Specifies the total 'depth' of the heightfield along the geom's local z axis.
widthSamples - Specifies the number of vertices to sample along the width of the heightfield. Each vertex has a corresponding height value which forms the overall shape. Naturally this value must be at least two or more.
depthSamples - Specifies the number of vertices to sample along the depth of the heightfield.
scale - A uniform scale applied to all raw height data.
offset - An offset applied to the scaled height data.
thickness - A value subtracted from the lowest height value 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.
bWrap - If non-zero the heightfield will infinitely tile in both directions along the local x and z axes. If zero the heightfield is bounded from zero to width in the local x axis, and zero to depth in the local z axis.

buildByte

void buildByte(byte[] pHeightData,
               boolean bCopyHeightData,
               double width,
               double depth,
               int widthSamples,
               int depthSamples,
               double scale,
               double offset,
               double thickness,
               boolean bWrap)
Deprecated. Please use build(byte[], ...) instead.

Parameters:
pHeightData -
bCopyHeightData -
width -
depth -
widthSamples -
depthSamples -
scale -
offset -
thickness -
bWrap -

build

void build(short[] pHeightData,
           boolean bCopyHeightData,
           double width,
           double depth,
           int widthSamples,
           int depthSamples,
           double scale,
           double offset,
           double thickness,
           boolean bWrap)
Configures a dHeightfieldData to use height data in short format.

Before a dHeightfieldData can be used by a geom it must be configured to specify the format of the height data. This call specifies that the heightfield data is stored as a rectangular array of shorts (16 bit signed) representing the height at each sample point.

See build(double[], ...) for example code.

Parameters:
pHeightData - A pointer to the height data.
bCopyHeightData - When non-zero the height data is copied to an internal store. When zero the height data is accessed by reference and so must persist throughout the lifetime of the heightfield.
width - Specifies the total 'width' of the heightfield along the geom's local x axis.
depth - Specifies the total 'depth' of the heightfield along the geom's local z axis.
widthSamples - Specifies the number of vertices to sample along the width of the heightfield. Each vertex has a corresponding height value which forms the overall shape. Naturally this value must be at least two or more.
depthSamples - Specifies the number of vertices to sample along the depth of the heightfield.
scale - A uniform scale applied to all raw height data.
offset - An offset applied to the scaled height data.
thickness - A value subtracted from the lowest height value 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.
bWrap - If non-zero the heightfield will infinitely tile in both directions along the local x and z axes. If zero the heightfield is bounded from zero to width in the local x axis, and zero to depth in the local z axis.

build

void build(float[] pHeightData,
           boolean bCopyHeightData,
           double width,
           double depth,
           int widthSamples,
           int depthSamples,
           double scale,
           double offset,
           double thickness,
           boolean bWrap)
Configures a dHeightfieldData to use height data in single precision floating point format.

Before a dHeightfieldData can be used by a geom it must be configured to specify the format of the height data. This call specifies that the heightfield data is stored as a rectangular array of single precision floats representing the height at each sample point.

See build(double[], ...) for example code.

Parameters:
pHeightData - A pointer to the height data.
bCopyHeightData - When non-zero the height data is copied to an internal store. When zero the height data is accessed by reference and so must persist throughout the lifetime of the heightfield.
width - Specifies the total 'width' of the heightfield along the geom's local x axis.
depth - Specifies the total 'depth' of the heightfield along the geom's local z axis.
widthSamples - Specifies the number of vertices to sample along the width of the heightfield. Each vertex has a corresponding height value which forms the overall shape. Naturally this value must be at least two or more.
depthSamples - Specifies the number of vertices to sample along the depth of the heightfield.
scale - A uniform scale applied to all raw height data.
offset - An offset applied to the scaled height data.
thickness - A value subtracted from the lowest height value 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.
bWrap - If non-zero the heightfield will infinitely tile in both directions along the local x and z axes. If zero the heightfield is bounded from zero to width in the local x axis, and zero to depth in the local z axis.

build

void build(double[] pHeightData,
           boolean bCopyHeightData,
           double width,
           double depth,
           int widthSamples,
           int depthSamples,
           double scale,
           double offset,
           double thickness,
           boolean bWrap)
Configures a dHeightfieldData to use height data in double precision floating point format.

Before a dHeightfieldData can be used by a geom it must be configured to specify the format of the height data. This call specifies that the heightfield data is stored as a rectangular array of double precision floats representing the height at each sample point.

 DHeightfieldData heightData = OdeHelper.createHeightfieldData();
 double[] data = new double[MAX_X*MAX_Z];
 for (int x = 0; x < MAX_X; x++) {
    for (int z = 0; z < MAX_Z; z++) {
        data[x+MAX_X*z] = heightfieldFunction(x, z);
    }
 }
 heightData.build(data, false, X_WIDTH, Z_DEPTH, MAX_X, MAX_Z, 1.0, 0.0, 0.0, false );
 

See DemoHeightfield for a full example.

Parameters:
pHeightData - A pointer to the height data.
bCopyHeightData - When non-zero the height data is copied to an internal store. When zero the height data is accessed by reference and so must persist throughout the lifetime of the heightfield.
width - Specifies the total 'width' of the heightfield along the geom's local x axis.
depth - Specifies the total 'depth' of the heightfield along the geom's local z axis.
widthSamples - Specifies the number of vertices to sample along the width of the heightfield. Each vertex has a corresponding height value which forms the overall shape. Naturally this value must be at least two or more.
depthSamples - Specifies the number of vertices to sample along the depth of the heightfield.
scale - A uniform scale applied to all raw height data.
offset - An offset applied to the scaled height data.
thickness - A value subtracted from the lowest height value 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.
bWrap - If non-zero the heightfield will infinitely tile in both directions along the local x and z axes. If zero the heightfield is bounded from zero to width in the local x axis, and zero to depth in the local z axis.