Class that constructs a HeightFieldShape.
More...
#include <HeightFieldShape.h>
Class that constructs a HeightFieldShape.
◆ HeightFieldShapeSettings() [1/2]
HeightFieldShapeSettings::HeightFieldShapeSettings |
( |
| ) |
|
|
default |
Default constructor for deserialization.
◆ HeightFieldShapeSettings() [2/2]
Create a height field shape of inSampleCount * inSampleCount vertices. The height field is a surface defined by: inOffset + inScale * (x, inSamples[y * inSampleCount + x], y). where x and y are integers in the range x and y e [0, inSampleCount - 1]. inSampleCount: inSampleCount / mBlockSize must be a power of 2 and minimally 2. inSamples: inSampleCount^2 vertices. inMaterialIndices: (inSampleCount - 1)^2 indices that index into inMaterialList.
◆ CalculateBitsPerSampleForError()
uint32 HeightFieldShapeSettings::CalculateBitsPerSampleForError |
( |
float | inMaxError | ) |
const |
Given mBlockSize, mSampleCount and mHeightSamples, calculate the amount of bits needed to stay below absolute error inMaxError
- Parameters
-
inMaxError | Maximum allowed error in mHeightSamples after compression (note that this does not take mScale.Y into account) |
- Returns
- Needed bits per sample in the range [1, 8].
◆ Create()
Create a shape according to the settings specified by this object.
Implements ShapeSettings.
◆ DetermineMinAndMaxSample()
void HeightFieldShapeSettings::DetermineMinAndMaxSample |
( |
float & | outMinValue, |
|
|
float & | outMaxValue, |
|
|
float & | outQuantizationScale ) const |
Determine the minimal and maximal value of mHeightSamples (will ignore cNoCollisionValue)
- Parameters
-
outMinValue | The minimal value fo mHeightSamples or FLT_MAX if no samples have collision |
outMaxValue | The maximal value fo mHeightSamples or -FLT_MAX if no samples have collision |
outQuantizationScale | (value - outMinValue) * outQuantizationScale quantizes a height sample to 16 bits |
◆ mBitsPerSample
uint32 HeightFieldShapeSettings::mBitsPerSample = 8 |
How many bits per sample to use to compress the height field. Can be in the range [1, 8]. Note that each sample is compressed relative to the min/max value of its block of mBlockSize * mBlockSize pixels so the effective precision is higher. Also note that increasing mBlockSize saves more memory than reducing the amount of bits per sample.
◆ mBlockSize
uint32 HeightFieldShapeSettings::mBlockSize = 2 |
The heightfield is divided in blocks of mBlockSize * mBlockSize * 2 triangles and the acceleration structure culls blocks only, bigger block sizes reduce memory consumption but also reduce query performance. Sensible values are [2, 8], does not need to be a power of 2. Note that at run-time we'll perform one more grid subdivision, so the effective block size is half of what is provided here.
◆ mHeightSamples
Array<float> HeightFieldShapeSettings::mHeightSamples |
◆ mMaterialIndices
Array<uint8> HeightFieldShapeSettings::mMaterialIndices |
◆ mMaterials
The materials of square at (x, y) is: mMaterials[mMaterialIndices[x + y * (mSampleCount - 1)]].
◆ mOffset
The height field is a surface defined by: mOffset + mScale * (x, mHeightSamples[y * mSampleCount + x], y). where x and y are integers in the range x and y e [0, mSampleCount - 1].
◆ mSampleCount
uint32 HeightFieldShapeSettings::mSampleCount = 0 |
◆ mScale
The documentation for this class was generated from the following files: