mirror of
https://github.com/ahwootech/BRUTAL.git
synced 2026-11-25 20:48:24 +01:00
559 lines
28 KiB
C#
559 lines
28 KiB
C#
// <auto-generated/>
|
|
// Generated by Brutal.Jolt.Generate; do not edit by hand.
|
|
#nullable enable
|
|
|
|
using System.Runtime.CompilerServices;
|
|
using Brutal.Interop;
|
|
using Brutal.Numerics;
|
|
|
|
namespace Brutal.JoltApi
|
|
{
|
|
/// <summary>
|
|
/// <para>
|
|
/// Class that constructs a HeightFieldShape
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/Shape/HeightFieldShape.h#L42">Jolt/Physics/Collision/Shape/HeightFieldShape.h:42</see>
|
|
/// <br/>
|
|
/// <c>class HeightFieldShapeSettings final : public ShapeSettings</c>
|
|
/// </para>
|
|
/// </summary>
|
|
[InteropHandle]
|
|
public readonly partial struct HeightFieldShapeSettings : IDisposable
|
|
{
|
|
/// <summary>
|
|
/// <para>
|
|
/// 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 minimally
|
|
/// 2 and a power of 2 is the most efficient in terms of performance and storage. inSamples: inSampleCount^2
|
|
/// vertices. inMaterialIndices: (inSampleCount - 1)^2 indices that index into inMaterialList.
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/Shape/HeightFieldShape.h#L56">Jolt/Physics/Collision/Shape/HeightFieldShape.h:56</see>
|
|
/// <br/>
|
|
/// <c>HeightFieldShapeSettings(const float *inSamples, Vec3Arg inOffset, Vec3Arg inScale, uint32 inSampleCount, const uint8 *inMaterialIndices = nullptr, const PhysicsMaterialList &inMaterialList = PhysicsMaterialList())</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <para>
|
|
/// materialList is copied into a native container for the call; the span is only read.
|
|
/// </para>
|
|
/// </remarks>
|
|
public static unsafe HeightFieldShapeSettings Create(
|
|
Ptr<float> samples,
|
|
float3 offset,
|
|
float3 scale,
|
|
uint sampleCount,
|
|
Ptr<byte> materialIndices,
|
|
ReadOnlySpan<PhysicsMaterial> materialList
|
|
)
|
|
{
|
|
fixed (PhysicsMaterial* materialList_fixed = materialList)
|
|
{
|
|
return Jolt.PInvoke.HeightFieldShapeSettings_Create(
|
|
samples,
|
|
offset,
|
|
scale,
|
|
sampleCount,
|
|
materialIndices,
|
|
materialList_fixed,
|
|
(nuint)materialList.Length
|
|
);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Default constructor for deserialization
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/Shape/HeightFieldShape.h#L48">Jolt/Physics/Collision/Shape/HeightFieldShape.h:48</see>
|
|
/// <br/>
|
|
/// <c>HeightFieldShapeSettings() = default</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public static HeightFieldShapeSettings Create() => Jolt.PInvoke.HeightFieldShapeSettings_Create_2();
|
|
|
|
/// <inheritdoc cref="ShapeSettings.GetRTTI()"/>
|
|
public RTTI GetRTTI() => ((ShapeSettings)this).GetRTTI();
|
|
|
|
/// <inheritdoc cref="ShapeSettings.CastTo(RTTI)"/>
|
|
public unsafe Ptr CastTo(RTTI rtti) => ((ShapeSettings)this).CastTo(rtti);
|
|
|
|
/// <inheritdoc cref="ShapeSettings.CreateShape()"/>
|
|
public Shape CreateShape() => ((ShapeSettings)this).CreateShape();
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Determine the minimal and maximal value of mHeightSamples (will ignore cNoCollisionValue)
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/Shape/HeightFieldShape.h#L65">Jolt/Physics/Collision/Shape/HeightFieldShape.h:65</see>
|
|
/// <br/>
|
|
/// <c>void DetermineMinAndMaxSample(float &outMinValue, float &outMaxValue, float &outQuantizationScale) const</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <code>
|
|
/// Determine the minimal and maximal value of mHeightSamples (will ignore cNoCollisionValue)
|
|
/// @param outMinValue The minimal value of mHeightSamples or FLT_MAX if no samples have collision
|
|
/// @param outMaxValue The maximal value of mHeightSamples or -FLT_MAX if no samples have collision
|
|
/// @param outQuantizationScale (value - outMinValue) * outQuantizationScale quantizes a height sample to 16 bits
|
|
/// </code>
|
|
/// </remarks>
|
|
public void DetermineMinAndMaxSample(out float minValue, out float maxValue, out float quantizationScale) =>
|
|
Jolt.PInvoke.HeightFieldShapeSettings_DetermineMinAndMaxSample(
|
|
this,
|
|
out minValue,
|
|
out maxValue,
|
|
out quantizationScale
|
|
);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Given mBlockSize, mSampleCount and mHeightSamples, calculate the amount of bits needed to stay below
|
|
/// absolute error inMaxError
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/Shape/HeightFieldShape.h#L70">Jolt/Physics/Collision/Shape/HeightFieldShape.h:70</see>
|
|
/// <br/>
|
|
/// <c>uint32 CalculateBitsPerSampleForError(float inMaxError) const</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <code>
|
|
/// Given mBlockSize, mSampleCount and mHeightSamples, calculate the amount of bits needed to stay below absolute error inMaxError
|
|
/// @param inMaxError Maximum allowed error in mHeightSamples after compression (note that this does not take mScale.Y into account)
|
|
/// @return Needed bits per sample in the range [1, 16].
|
|
/// </code>
|
|
/// </remarks>
|
|
public uint CalculateBitsPerSampleForError(float maxError) =>
|
|
Jolt.PInvoke.HeightFieldShapeSettings_CalculateBitsPerSampleForError(this, maxError);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// 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].
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/Shape/HeightFieldShape.h#L74">Jolt/Physics/Collision/Shape/HeightFieldShape.h:74</see>
|
|
/// <br/>
|
|
/// <c>Vec3 mOffset = Vec3::sZero()</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public float3 GetOffset() => Jolt.PInvoke.HeightFieldShapeSettings_GetOffset(this);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// 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].
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/Shape/HeightFieldShape.h#L74">Jolt/Physics/Collision/Shape/HeightFieldShape.h:74</see>
|
|
/// <br/>
|
|
/// <c>Vec3 mOffset = Vec3::sZero()</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public void SetOffset(float3 value) => Jolt.PInvoke.HeightFieldShapeSettings_SetOffset(this, value);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/Shape/HeightFieldShape.h#L75">Jolt/Physics/Collision/Shape/HeightFieldShape.h:75</see>
|
|
/// <br/>
|
|
/// <c>Vec3 mScale = Vec3::sOne()</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public float3 GetScale() => Jolt.PInvoke.HeightFieldShapeSettings_GetScale(this);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/Shape/HeightFieldShape.h#L75">Jolt/Physics/Collision/Shape/HeightFieldShape.h:75</see>
|
|
/// <br/>
|
|
/// <c>Vec3 mScale = Vec3::sOne()</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public void SetScale(float3 value) => Jolt.PInvoke.HeightFieldShapeSettings_SetScale(this, value);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/Shape/HeightFieldShape.h#L76">Jolt/Physics/Collision/Shape/HeightFieldShape.h:76</see>
|
|
/// <br/>
|
|
/// <c>uint32 mSampleCount = 0</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public uint GetSampleCount() => Jolt.PInvoke.HeightFieldShapeSettings_GetSampleCount(this);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/Shape/HeightFieldShape.h#L76">Jolt/Physics/Collision/Shape/HeightFieldShape.h:76</see>
|
|
/// <br/>
|
|
/// <c>uint32 mSampleCount = 0</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public void SetSampleCount(uint value) => Jolt.PInvoke.HeightFieldShapeSettings_SetSampleCount(this, value);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Artificial minimal value of mHeightSamples, used for compression and can be used to update the terrain
|
|
/// after creating with lower height values. If there are any lower values in mHeightSamples, this value
|
|
/// will be ignored.
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/Shape/HeightFieldShape.h#L79">Jolt/Physics/Collision/Shape/HeightFieldShape.h:79</see>
|
|
/// <br/>
|
|
/// <c>float mMinHeightValue = cLargeFloat</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public float GetMinHeightValue() => Jolt.PInvoke.HeightFieldShapeSettings_GetMinHeightValue(this);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Artificial minimal value of mHeightSamples, used for compression and can be used to update the terrain
|
|
/// after creating with lower height values. If there are any lower values in mHeightSamples, this value
|
|
/// will be ignored.
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/Shape/HeightFieldShape.h#L79">Jolt/Physics/Collision/Shape/HeightFieldShape.h:79</see>
|
|
/// <br/>
|
|
/// <c>float mMinHeightValue = cLargeFloat</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public void SetMinHeightValue(float value) =>
|
|
Jolt.PInvoke.HeightFieldShapeSettings_SetMinHeightValue(this, value);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Artificial maximum value of mHeightSamples, used for compression and can be used to update the terrain
|
|
/// after creating with higher height values. If there are any higher values in mHeightSamples, this value
|
|
/// will be ignored.
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/Shape/HeightFieldShape.h#L82">Jolt/Physics/Collision/Shape/HeightFieldShape.h:82</see>
|
|
/// <br/>
|
|
/// <c>float mMaxHeightValue = -cLargeFloat</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public float GetMaxHeightValue() => Jolt.PInvoke.HeightFieldShapeSettings_GetMaxHeightValue(this);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Artificial maximum value of mHeightSamples, used for compression and can be used to update the terrain
|
|
/// after creating with higher height values. If there are any higher values in mHeightSamples, this value
|
|
/// will be ignored.
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/Shape/HeightFieldShape.h#L82">Jolt/Physics/Collision/Shape/HeightFieldShape.h:82</see>
|
|
/// <br/>
|
|
/// <c>float mMaxHeightValue = -cLargeFloat</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public void SetMaxHeightValue(float value) =>
|
|
Jolt.PInvoke.HeightFieldShapeSettings_SetMaxHeightValue(this, value);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// When bigger than mMaterials.size() the internal material list will be preallocated to support this
|
|
/// number of materials. This avoids reallocations when calling HeightFieldShape::SetMaterials with new
|
|
/// materials later.
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/Shape/HeightFieldShape.h#L86">Jolt/Physics/Collision/Shape/HeightFieldShape.h:86</see>
|
|
/// <br/>
|
|
/// <c>uint32 mMaterialsCapacity = 0</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public uint GetMaterialsCapacity() => Jolt.PInvoke.HeightFieldShapeSettings_GetMaterialsCapacity(this);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// When bigger than mMaterials.size() the internal material list will be preallocated to support this
|
|
/// number of materials. This avoids reallocations when calling HeightFieldShape::SetMaterials with new
|
|
/// materials later.
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/Shape/HeightFieldShape.h#L86">Jolt/Physics/Collision/Shape/HeightFieldShape.h:86</see>
|
|
/// <br/>
|
|
/// <c>uint32 mMaterialsCapacity = 0</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public void SetMaterialsCapacity(uint value) =>
|
|
Jolt.PInvoke.HeightFieldShapeSettings_SetMaterialsCapacity(this, value);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// 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. Valid 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.
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/Shape/HeightFieldShape.h#L91">Jolt/Physics/Collision/Shape/HeightFieldShape.h:91</see>
|
|
/// <br/>
|
|
/// <c>uint32 mBlockSize = 2</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public uint GetBlockSize() => Jolt.PInvoke.HeightFieldShapeSettings_GetBlockSize(this);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// 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. Valid 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.
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/Shape/HeightFieldShape.h#L91">Jolt/Physics/Collision/Shape/HeightFieldShape.h:91</see>
|
|
/// <br/>
|
|
/// <c>uint32 mBlockSize = 2</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public void SetBlockSize(uint value) => Jolt.PInvoke.HeightFieldShapeSettings_SetBlockSize(this, value);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// How many bits per sample to use to compress the height field. Can be in the range [1, 16]. Note that
|
|
/// each sample is compressed relative to the min/max value of its block of mBlockSize * mBlockSize samples
|
|
/// so the effective precision is higher. Also note that increasing mBlockSize saves more memory than
|
|
/// reducing the amount of bits per sample.
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/Shape/HeightFieldShape.h#L96">Jolt/Physics/Collision/Shape/HeightFieldShape.h:96</see>
|
|
/// <br/>
|
|
/// <c>uint32 mBitsPerSample = 8</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public uint GetBitsPerSample() => Jolt.PInvoke.HeightFieldShapeSettings_GetBitsPerSample(this);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// How many bits per sample to use to compress the height field. Can be in the range [1, 16]. Note that
|
|
/// each sample is compressed relative to the min/max value of its block of mBlockSize * mBlockSize samples
|
|
/// so the effective precision is higher. Also note that increasing mBlockSize saves more memory than
|
|
/// reducing the amount of bits per sample.
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/Shape/HeightFieldShape.h#L96">Jolt/Physics/Collision/Shape/HeightFieldShape.h:96</see>
|
|
/// <br/>
|
|
/// <c>uint32 mBitsPerSample = 8</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public void SetBitsPerSample(uint value) => Jolt.PInvoke.HeightFieldShapeSettings_SetBitsPerSample(this, value);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// An array of mSampleCount^2 height samples. Samples are stored in row major order, so the sample at (x,
|
|
/// y) is at index y * mSampleCount + x.
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/Shape/HeightFieldShape.h#L99">Jolt/Physics/Collision/Shape/HeightFieldShape.h:99</see>
|
|
/// <br/>
|
|
/// <c>Array<float> mHeightSamples</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <para>
|
|
/// The span is a view of the container's own storage, not a copy: edits land in the object that owns it.
|
|
/// It's only valid until that container is resized or its owner is destroyed.
|
|
/// </para>
|
|
/// </remarks>
|
|
[return: Brutal.Attributes.Fixed]
|
|
public unsafe Span<float> GetHeightSamples()
|
|
{
|
|
Jolt.PInvoke.HeightFieldShapeSettings_GetHeightSamples(this, out var _outResult);
|
|
return new Span<float>((void*)_outResult.Data, checked((int)_outResult.Count));
|
|
}
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// An array of mSampleCount^2 height samples. Samples are stored in row major order, so the sample at (x,
|
|
/// y) is at index y * mSampleCount + x.
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/Shape/HeightFieldShape.h#L99">Jolt/Physics/Collision/Shape/HeightFieldShape.h:99</see>
|
|
/// <br/>
|
|
/// <c>Array<float> mHeightSamples</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public unsafe void SetHeightSamples(ReadOnlySpan<float> value)
|
|
{
|
|
fixed (float* value_fixed = value)
|
|
{
|
|
Jolt.PInvoke.HeightFieldShapeSettings_SetHeightSamples(this, value_fixed, (nuint)value.Length);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// An array of (mSampleCount - 1)^2 material indices.
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/Shape/HeightFieldShape.h#L102">Jolt/Physics/Collision/Shape/HeightFieldShape.h:102</see>
|
|
/// <br/>
|
|
/// <c>Array<uint8> mMaterialIndices</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <para>
|
|
/// The span is a view of the container's own storage, not a copy: edits land in the object that owns it.
|
|
/// It's only valid until that container is resized or its owner is destroyed.
|
|
/// </para>
|
|
/// </remarks>
|
|
[return: Brutal.Attributes.Fixed]
|
|
public unsafe Span<byte> GetMaterialIndices()
|
|
{
|
|
Jolt.PInvoke.HeightFieldShapeSettings_GetMaterialIndices(this, out var _outResult);
|
|
return new Span<byte>((void*)_outResult.Data, checked((int)_outResult.Count));
|
|
}
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// An array of (mSampleCount - 1)^2 material indices.
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/Shape/HeightFieldShape.h#L102">Jolt/Physics/Collision/Shape/HeightFieldShape.h:102</see>
|
|
/// <br/>
|
|
/// <c>Array<uint8> mMaterialIndices</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public unsafe void SetMaterialIndices(ReadOnlySpan<byte> value)
|
|
{
|
|
fixed (byte* value_fixed = value)
|
|
{
|
|
Jolt.PInvoke.HeightFieldShapeSettings_SetMaterialIndices(this, value_fixed, (nuint)value.Length);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// The materials of square at (x, y) is: mMaterials[mMaterialIndices[x + y * (mSampleCount - 1)]]
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/Shape/HeightFieldShape.h#L105">Jolt/Physics/Collision/Shape/HeightFieldShape.h:105</see>
|
|
/// <br/>
|
|
/// <c>PhysicsMaterialList mMaterials</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <para>
|
|
/// Returns an owned native buffer - read it through AsSpan() and Dispose it when you are done with it. The
|
|
/// handles in it are borrowed views into the buffer: they stay valid until Dispose and must not be disposed
|
|
/// themselves.
|
|
/// </para>
|
|
/// </remarks>
|
|
public NativeArray<PhysicsMaterial> GetMaterials() =>
|
|
new NativeArray<PhysicsMaterial>(Jolt.PInvoke.HeightFieldShapeSettings_GetMaterials(this));
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// The materials of square at (x, y) is: mMaterials[mMaterialIndices[x + y * (mSampleCount - 1)]]
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/Shape/HeightFieldShape.h#L105">Jolt/Physics/Collision/Shape/HeightFieldShape.h:105</see>
|
|
/// <br/>
|
|
/// <c>PhysicsMaterialList mMaterials</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public unsafe void SetMaterials(ReadOnlySpan<PhysicsMaterial> value)
|
|
{
|
|
fixed (PhysicsMaterial* value_fixed = value)
|
|
{
|
|
Jolt.PInvoke.HeightFieldShapeSettings_SetMaterials(this, value_fixed, (nuint)value.Length);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// cos(5 degrees)
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/Shape/HeightFieldShape.h#L110">Jolt/Physics/Collision/Shape/HeightFieldShape.h:110</see>
|
|
/// <br/>
|
|
/// <c>float mActiveEdgeCosThresholdAngle = 0.996195f</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <code>
|
|
/// Cosine of the threshold angle (if the angle between the two triangles is bigger than this, the edge is active, note that a concave edge is always inactive).
|
|
/// Setting this value too small can cause ghost collisions with edges, setting it too big can cause depenetration artifacts (objects not depenetrating quickly).
|
|
/// Valid ranges are between cos(0 degrees) and cos(90 degrees). The default value is cos(5 degrees).
|
|
/// </code>
|
|
/// </remarks>
|
|
public float GetActiveEdgeCosThresholdAngle() =>
|
|
Jolt.PInvoke.HeightFieldShapeSettings_GetActiveEdgeCosThresholdAngle(this);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// cos(5 degrees)
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/Shape/HeightFieldShape.h#L110">Jolt/Physics/Collision/Shape/HeightFieldShape.h:110</see>
|
|
/// <br/>
|
|
/// <c>float mActiveEdgeCosThresholdAngle = 0.996195f</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <code>
|
|
/// Cosine of the threshold angle (if the angle between the two triangles is bigger than this, the edge is active, note that a concave edge is always inactive).
|
|
/// Setting this value too small can cause ghost collisions with edges, setting it too big can cause depenetration artifacts (objects not depenetrating quickly).
|
|
/// Valid ranges are between cos(0 degrees) and cos(90 degrees). The default value is cos(5 degrees).
|
|
/// </code>
|
|
/// </remarks>
|
|
public void SetActiveEdgeCosThresholdAngle(float value) =>
|
|
Jolt.PInvoke.HeightFieldShapeSettings_SetActiveEdgeCosThresholdAngle(this, value);
|
|
|
|
public void AddRef() => ((ShapeSettings)this).AddRef();
|
|
|
|
public void Release() => ((ShapeSettings)this).Release();
|
|
|
|
public uint GetRefCount() => ((ShapeSettings)this).GetRefCount();
|
|
|
|
public static implicit operator ShapeSettings(HeightFieldShapeSettings value) =>
|
|
Unsafe.BitCast<HeightFieldShapeSettings, ShapeSettings>(value);
|
|
|
|
public void Dispose()
|
|
{
|
|
if (IsNull())
|
|
return;
|
|
Release();
|
|
}
|
|
|
|
/// <inheritdoc cref="ShapeSettings.ClearCachedResult()"/>
|
|
public void ClearCachedResult() => ((ShapeSettings)this).ClearCachedResult();
|
|
|
|
/// <inheritdoc cref="ShapeSettings.GetUserData()"/>
|
|
public ulong GetUserData() => ((ShapeSettings)this).GetUserData();
|
|
|
|
/// <inheritdoc cref="ShapeSettings.SetUserData(ulong)"/>
|
|
public void SetUserData(ulong value) => ((ShapeSettings)this).SetUserData(value);
|
|
}
|
|
}
|