Interface ConstHeightFieldShapeSettings
- All Superinterfaces:
AutoCloseable,Comparable<JoltPhysicsObject>,ConstJoltPhysicsObject,ConstSerializableObject,ConstShapeSettings
- All Known Implementing Classes:
HeightFieldShapeSettings
Read-only access to a
HeightFieldShapeSettings object. (native type:
const HeightFieldShapeSettings)-
Method Summary
Modifier and TypeMethodDescriptionintcalculateBitsPerSampleForError(float maxError) Calculate the minimum bits per sample that will provide the specified error tolerance.intCount the height samples, includingcNoCollisionValue.intCount the references in the material list, including null refs.intCount the squares.voiddetermineMinAndMaxSample(float[] storeMin, float[] storeMax, float[] storeQuantScale) Calculate 3 quantization parameters of the current settings.floatReturn the cosine of the active-edge threshold angle.intReturn the number of bits per sample to use during compression.intReturn the block size.floatgetHeightSample(int sampleIndex) Return the height of the specified sample.floatgetHeightSample(int x, int y) Return the height of the specified sample.intgetMaterialIndex(int squareIndex) Return the material index for the specified square.intgetMaterialIndex(int x, int y) Return the material index for the specified square.getMaterialRef(int materialIndex) Return a reference to the material for the specified material index.getMaterialRef(int x, int y) Return a reference to the material for the specified square.getMaterialRefForSquare(int squareIndex) Return a reference to the material for the specified square.intReturn the artificial minimum capacity for the created shape's material list.floatReturn the artificial maximum height.floatReturn the artificial minimum height.Copy the offset of the first sample.intCount the samples along each edge.getScale()Copy the scale factors.Methods inherited from interface java.lang.Comparable
compareToMethods inherited from interface com.github.stephengold.joltjni.readonly.ConstJoltPhysicsObject
close, hasAssignedNativeObject, ownsNativeObject, targetVa, targetVaOrZeroMethods inherited from interface com.github.stephengold.joltjni.readonly.ConstSerializableObject
getRttiMethods inherited from interface com.github.stephengold.joltjni.readonly.ConstShapeSettings
create, getRefCount, toRefC
-
Method Details
-
calculateBitsPerSampleForError
int calculateBitsPerSampleForError(float maxError) Calculate the minimum bits per sample that will provide the specified error tolerance. The settings are unaffected.- Parameters:
maxError- the allowable tolerance- Returns:
- the (hypothetical) bits per sample
-
countHeights
int countHeights()Count the height samples, includingcNoCollisionValue. The settings are unaffected.- Returns:
- the actual number of samples in the array (≥0)
-
countMaterials
int countMaterials()Count the references in the material list, including null refs. The settings are unaffected.- Returns:
- the actual number of references in the list (≥0)
-
countSquares
int countSquares()Count the squares. The settings are unaffected.- Returns:
- the actual number of material indices in the array (≥0)
-
determineMinAndMaxSample
void determineMinAndMaxSample(float[] storeMin, float[] storeMax, float[] storeQuantScale) Calculate 3 quantization parameters of the current settings. The settings are unaffected.- Parameters:
storeMin- storage for the minimum height (ignoringcNoCollisionValue) orMIN_VALUEif no samples have collisionstoreMax- storage for the maximum height (ignoringcNoCollisionValue) orMAX_VALUEif no samples have collisionstoreQuantScale- storage for the quantization scale factor
-
getActiveEdgeCosThresholdAngle
float getActiveEdgeCosThresholdAngle()Return the cosine of the active-edge threshold angle. The settings are unaffected.- Returns:
- the cosine
-
getBitsPerSample
int getBitsPerSample()Return the number of bits per sample to use during compression. The settings are unaffected.- Returns:
- the number of bits (≥1, ≤16)
-
getBlockSize
int getBlockSize()Return the block size. The settings are unaffected.For culling purposes, the height field is organized in blocks of
2 * mBlockSize * mBlockSizetriangles.Sensible values range from 2 to 8.
- Returns:
- the block size (in rows)
-
getHeightSample
float getHeightSample(int sampleIndex) Return the height of the specified sample. The settings are unaffected.- Parameters:
sampleIndex- the array index (≥0, <sampleCount^2)- Returns:
- the sample height or
cNoCollisionValue
-
getHeightSample
float getHeightSample(int x, int y) Return the height of the specified sample. The settings are unaffected.- Parameters:
x- the X index of the sample (≥0, <sampleCount)y- the Y index of the sample (≥0, <sampleCount)- Returns:
- the sample height or
cNoCollisionValue
-
getMaterialIndex
int getMaterialIndex(int squareIndex) Return the material index for the specified square. The settings are unaffected.- Parameters:
squareIndex- the index of the square (≥0, <(sampleCount-1)^2)- Returns:
- an index into the material list (≥0)
-
getMaterialIndex
int getMaterialIndex(int x, int y) Return the material index for the specified square. The settings are unaffected.- Parameters:
x- the X index of the square (≥0, <sampleCount-1)y- the Y index of the square (≥0, <sampleCount-1)- Returns:
- an index into the material list (≥0)
-
getMaterialRef
Return a reference to the material for the specified material index.- Parameters:
materialIndex- the index in the local table (≥0)- Returns:
- a new counted reference to the existing material
-
getMaterialRef
Return a reference to the material for the specified square.- Parameters:
x- the X index of the square (≥0, <sampleCount-1)y- the Y index of the square (≥0, <sampleCount-1)- Returns:
- a new counted reference to the existing material
-
getMaterialRefForSquare
Return a reference to the material for the specified square.- Parameters:
squareIndex- the index of the square (≥0, <(sampleCount-1)^2)- Returns:
- a new counted reference to the existing material
-
getMaterialsCapacity
int getMaterialsCapacity()Return the artificial minimum capacity for the created shape's material list. The settings are unaffected.- Returns:
- the capacity (in refs)
-
getMaxHeightValue
float getMaxHeightValue()Return the artificial maximum height. The settings are unaffected.- Returns:
- the height value
-
getMinHeightValue
float getMinHeightValue()Return the artificial minimum height. The settings are unaffected.- Returns:
- the height value
-
getOffset
Vec3 getOffset()Copy the offset of the first sample. The settings are unaffected.- Returns:
- a new offset vector
-
getSampleCount
int getSampleCount()Count the samples along each edge. The settings are unaffected.- Returns:
- the number of samples (≥0)
-
getScale
Vec3 getScale()Copy the scale factors. The settings are unaffected.- Returns:
- a new scaling vector
-