Package com.github.stephengold.joltjni
Class HeightFieldShapeSettings
java.lang.Object
com.github.stephengold.joltjni.JoltPhysicsObject
com.github.stephengold.joltjni.NonCopyable
com.github.stephengold.joltjni.SerializableObject
com.github.stephengold.joltjni.ShapeSettings
com.github.stephengold.joltjni.HeightFieldShapeSettings
- All Implemented Interfaces:
ConstJoltPhysicsObject
,ConstShapeSettings
,RefTarget
,AutoCloseable
,Comparable<JoltPhysicsObject>
Settings used to construct a
HeightFieldShape
.-
Constructor Summary
ConstructorsConstructorDescriptionHeightFieldShapeSettings
(float[] samples, Vec3Arg offset, Vec3Arg scale, int sampleCount) Instantiate settings for the specified samples.HeightFieldShapeSettings
(float[] samples, Vec3Arg offset, Vec3Arg scale, int sampleCount, byte[] materialIndices) Instantiate settings for the specified samples.HeightFieldShapeSettings
(float[] samples, Vec3Arg offset, Vec3Arg scale, int sampleCount, byte[] materialIndices, PhysicsMaterialList materialList) Instantiate settings for the specified samples.HeightFieldShapeSettings
(FloatBuffer samples, Vec3Arg offset, Vec3Arg scale, int sampleCount) Instantiate settings for the specified samples.HeightFieldShapeSettings
(FloatBuffer samples, Vec3Arg offset, Vec3Arg scale, int sampleCount, byte[] materialIndices) Instantiate settings for the specified samples.HeightFieldShapeSettings
(FloatBuffer samples, Vec3Arg offset, Vec3Arg scale, int sampleCount, byte[] materialIndices, PhysicsMaterialList materialList) Instantiate settings for the specified samples. -
Method Summary
Modifier and TypeMethodDescriptionfloat
Return the cosine of the active-edge threshold angle.int
Return the number of bits per sample to use during compression.int
Return the block size.float
Return the artificial maximum height.float
Return the artificial minimum height.Copy the offset of the first sample.int
Count the samples.getScale()
Copy the scale factors.void
setActiveEdgeCosThresholdAngle
(float cosine) Alter the active-edge threshold angle.void
setBitsPerSample
(int numBits) Alter the number of bits per sample to use during compression.void
setBlockSize
(int numRows) Alter the block size.void
setMaxHeightValue
(float maxHeight) Alter the artificial maximum height.void
setMinHeightValue
(float minHeight) Alter the artificial minimum height.void
Alter the offset of the first sample.void
Alter the scale factors.Methods inherited from class com.github.stephengold.joltjni.ShapeSettings
clearCachedResult, create, getRefCount, setEmbedded, toRef, toRefC
Methods inherited from class com.github.stephengold.joltjni.JoltPhysicsObject
close, compareTo, equals, getContainingObject, hasAssignedNativeObject, hashCode, ownsNativeObject, setVirtualAddress, setVirtualAddress, startCleaner, targetVa, toString, va
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Comparable
compareTo
Methods inherited from interface com.github.stephengold.joltjni.readonly.ConstJoltPhysicsObject
close, hasAssignedNativeObject, ownsNativeObject, targetVa
-
Constructor Details
-
HeightFieldShapeSettings
Instantiate settings for the specified samples.- Parameters:
samples
- array of height values (not null, length≥4, unaffected)offset
- (not null, unaffected)scale
- (not null, unaffected)sampleCount
- the number of height values along each edge (≥2*blockSize)
-
HeightFieldShapeSettings
public HeightFieldShapeSettings(float[] samples, Vec3Arg offset, Vec3Arg scale, int sampleCount, byte[] materialIndices) Instantiate settings for the specified samples.- Parameters:
samples
- array of height values (not null, length≥4, unaffected)offset
- (not null, unaffected)scale
- (not null, unaffected)sampleCount
- the number of height values along each edge (≥2*blockSize)materialIndices
- a material index for each sample (default=null)
-
HeightFieldShapeSettings
public HeightFieldShapeSettings(float[] samples, Vec3Arg offset, Vec3Arg scale, int sampleCount, byte[] materialIndices, PhysicsMaterialList materialList) Instantiate settings for the specified samples.- Parameters:
samples
- array of height values (not null, length≥4, unaffected)offset
- (not null, unaffected)scale
- (not null, unaffected)sampleCount
- the number of height values along each edge (≥2*blockSize)materialIndices
- a material index for each sample (default=null)materialList
- the list of materials
-
HeightFieldShapeSettings
public HeightFieldShapeSettings(FloatBuffer samples, Vec3Arg offset, Vec3Arg scale, int sampleCount) Instantiate settings for the specified samples.- Parameters:
samples
- array of height values (not null, capacity≥4, unaffected)offset
- (not null, unaffected)scale
- (not null, unaffected)sampleCount
- the number of height values along each edge (≥2*blockSize)
-
HeightFieldShapeSettings
public HeightFieldShapeSettings(FloatBuffer samples, Vec3Arg offset, Vec3Arg scale, int sampleCount, byte[] materialIndices) Instantiate settings for the specified samples.- Parameters:
samples
- array of height values (not null, capacity≥4, unaffected)offset
- (not null, unaffected)scale
- (not null, unaffected)sampleCount
- the number of height values along each edge (≥2*blockSize)materialIndices
- a material index for each sample (default=null)
-
HeightFieldShapeSettings
public HeightFieldShapeSettings(FloatBuffer samples, Vec3Arg offset, Vec3Arg scale, int sampleCount, byte[] materialIndices, PhysicsMaterialList materialList) Instantiate settings for the specified samples.- Parameters:
samples
- array of height values (not null, capacity≥4, unaffected)offset
- (not null, unaffected)scale
- (not null, unaffected)sampleCount
- the number of height values along each edge (≥2*blockSize)materialIndices
- a material index for each sample (default=null)materialList
- the list of materials
-
-
Method Details
-
getActiveEdgeCosThresholdAngle
public float getActiveEdgeCosThresholdAngle()Return the cosine of the active-edge threshold angle. The settings are unaffected. (native attribute: mActiveEdgeCosThresholdAngle)- Returns:
- the cosine
-
getBitsPerSample
public int getBitsPerSample()Return the number of bits per sample to use during compression. The settings are unaffected. (native attribute: mBitsPerSample)- Returns:
- the number of bits (≥1, ≤8)
-
getBlockSize
public int getBlockSize()Return the block size. The settings are unaffected. (native attribute: mBlockSize)For culling purposes, the height field is organized in blocks of
2 * mBlockSize * mBlockSize
triangles.Sensible values range from 2 to 8.
- Returns:
- the block size (in rows)
-
getMaxHeightValue
public float getMaxHeightValue()Return the artificial maximum height. The settings are unaffected. (native attribute: mMaxHeightValue)- Returns:
- the height value
-
getMinHeightValue
public float getMinHeightValue()Return the artificial minimum height. The settings are unaffected. (native attribute: mMinHeightValue)- Returns:
- the height value
-
getOffset
Copy the offset of the first sample. The settings are unaffected. (native attribute: mOffset)- Returns:
- a new offset vector
-
getSampleCount
public int getSampleCount()Count the samples. The settings are unaffected. (native attribute: mSampleCount)- Returns:
- the number of samples (≥0)
-
getScale
Copy the scale factors. The settings are unaffected. (native attribute: mScale)- Returns:
- a new scaling vector
-
setActiveEdgeCosThresholdAngle
public void setActiveEdgeCosThresholdAngle(float cosine) Alter the active-edge threshold angle. (native attribute: mActiveEdgeCosThresholdAngle)- Parameters:
cosine
- the cosine of the desired angle (default=0.996195)
-
setBitsPerSample
public void setBitsPerSample(int numBits) Alter the number of bits per sample to use during compression. (native attribute: mBitsPerSample)- Parameters:
numBits
- the number of bits (≥1, ≤8, default=8)
-
setBlockSize
public void setBlockSize(int numRows) Alter the block size. (native attribute: mBlockSize)For culling purposes, the height field is organized in blocks of
2 * mBlockSize * mBlockSize
triangles.Sensible values range from 2 to 8.
- Parameters:
numRows
- the desired block size (in rows, default=2)
-
setMaxHeightValue
public void setMaxHeightValue(float maxHeight) Alter the artificial maximum height. (native attribute: mMaxHeightValue)- Parameters:
maxHeight
- the desired height value (default=-1e15)
-
setMinHeightValue
public void setMinHeightValue(float minHeight) Alter the artificial minimum height. (native attribute: mMinHeightValue)- Parameters:
minHeight
- the desired height value (default=1e15)
-
setOffset
Alter the offset of the first sample. (native attribute: mOffset)- Parameters:
offset
- the desired offset vector (not null, unaffected, default=(0,0,0))
-
setScale
Alter the scale factors. (native attribute: mScale)- Parameters:
scale
- the desired scale factors (not null, unaffected, default=(1,1,1))
-