mirror of
https://github.com/ahwootech/BRUTAL.git
synced 2026-11-25 20:48:24 +01:00
742 lines
37 KiB
C#
742 lines
37 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>
|
|
/// A height field shape. Cannot be used as a dynamic object.
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/Shape/HeightFieldShape.h#L118">Jolt/Physics/Collision/Shape/HeightFieldShape.h:118</see>
|
|
/// <br/>
|
|
/// <c>class HeightFieldShape final : public Shape</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <code>
|
|
/// A height field shape. Cannot be used as a dynamic object.
|
|
///
|
|
/// Note: If you're using HeightFieldShape and are querying data while modifying the shape you'll have a race condition.
|
|
/// In this case it is best to create a new HeightFieldShape using the Clone function. You replace the shape on a body using BodyInterface::SetShape.
|
|
/// If a query is still working on the old shape, it will have taken a reference and keep the old shape alive until the query finishes.
|
|
/// </code>
|
|
/// </remarks>
|
|
[InteropHandle]
|
|
public readonly partial struct HeightFieldShape : IDisposable
|
|
{
|
|
/// <summary>
|
|
/// <para>
|
|
/// A block of 2x2 ranges used to form a hierarchical grid, ordered left top, right top, left bottom, right
|
|
/// bottom
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/Shape/HeightFieldShape.h#L340">Jolt/Physics/Collision/Shape/HeightFieldShape.h:340</see>
|
|
/// <br/>
|
|
/// <c>struct alignas(16) RangeBlock</c>
|
|
/// </para>
|
|
/// </summary>
|
|
[StructLayout(LayoutKind.Explicit, Size = 16)]
|
|
public partial struct RangeBlock
|
|
{
|
|
/// <summary>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/Shape/HeightFieldShape.h#L342">Jolt/Physics/Collision/Shape/HeightFieldShape.h:342</see>
|
|
/// <br/>
|
|
/// <c>uint16 mMin[4]</c>
|
|
/// </para>
|
|
/// </summary>
|
|
[FieldOffset(0)]
|
|
public ushort_4 Min;
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/Shape/HeightFieldShape.h#L343">Jolt/Physics/Collision/Shape/HeightFieldShape.h:343</see>
|
|
/// <br/>
|
|
/// <c>uint16 mMax[4]</c>
|
|
/// </para>
|
|
/// </summary>
|
|
[FieldOffset(8)]
|
|
public ushort_4 Max;
|
|
}
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Constructor
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/Shape/HeightFieldShape.h#L124">Jolt/Physics/Collision/Shape/HeightFieldShape.h:124</see>
|
|
/// <br/>
|
|
/// <c>HeightFieldShape()</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public static HeightFieldShape Create() => Jolt.PInvoke.HeightFieldShape_Create();
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/Shape/HeightFieldShape.h#L125">Jolt/Physics/Collision/Shape/HeightFieldShape.h:125</see>
|
|
/// <br/>
|
|
/// <c>HeightFieldShape(const HeightFieldShapeSettings &inSettings, ShapeResult &outResult)</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public static HeightFieldShape Create(HeightFieldShapeSettings settings)
|
|
{
|
|
var _handle = Jolt.PInvoke.HeightFieldShape_Create_2(settings);
|
|
if (_handle.IsNull())
|
|
throw JoltException.FromLastError();
|
|
return _handle;
|
|
}
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Clone this shape. Can be used to avoid race conditions. See the documentation of this class for more
|
|
/// information.
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/Shape/HeightFieldShape.h#L129">Jolt/Physics/Collision/Shape/HeightFieldShape.h:129</see>
|
|
/// <br/>
|
|
/// <c>Ref<HeightFieldShape> Clone() const</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <para>
|
|
/// The returned handle carries its own reference; Dispose it once when you're done.
|
|
/// </para>
|
|
/// </remarks>
|
|
public HeightFieldShape Clone() => Jolt.PInvoke.HeightFieldShape_Clone(this);
|
|
|
|
/// <inheritdoc cref="Shape.MustBeStatic()"/>
|
|
public bool MustBeStatic() => ((Shape)this).MustBeStatic();
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Get the size of the height field. Note that this will always be rounded up to the nearest multiple of
|
|
/// GetBlockSize().
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/Shape/HeightFieldShape.h#L135">Jolt/Physics/Collision/Shape/HeightFieldShape.h:135</see>
|
|
/// <br/>
|
|
/// <c>inline uint GetSampleCount() const</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public uint GetSampleCount() => Jolt.PInvoke.HeightFieldShape_GetSampleCount(this);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Get the size of a block
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/Shape/HeightFieldShape.h#L138">Jolt/Physics/Collision/Shape/HeightFieldShape.h:138</see>
|
|
/// <br/>
|
|
/// <c>inline uint GetBlockSize() const</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public uint GetBlockSize() => Jolt.PInvoke.HeightFieldShape_GetBlockSize(this);
|
|
|
|
/// <inheritdoc cref="Shape.GetLocalBounds()"/>
|
|
public AABox GetLocalBounds() => ((Shape)this).GetLocalBounds();
|
|
|
|
/// <inheritdoc cref="Shape.GetSubShapeIDBitsRecursive()"/>
|
|
public uint GetSubShapeIDBitsRecursive() => ((Shape)this).GetSubShapeIDBitsRecursive();
|
|
|
|
/// <inheritdoc cref="Shape.GetInnerRadius()"/>
|
|
public float GetInnerRadius() => ((Shape)this).GetInnerRadius();
|
|
|
|
/// <inheritdoc cref="Shape.GetMassProperties()"/>
|
|
public MassProperties GetMassProperties() => ((Shape)this).GetMassProperties();
|
|
|
|
/// <inheritdoc cref="Shape.GetMaterial(uint)"/>
|
|
public PhysicsMaterial GetMaterial(uint subShapeID) => ((Shape)this).GetMaterial(subShapeID);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Overload to get the material at a particular location
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/Shape/HeightFieldShape.h#L156">Jolt/Physics/Collision/Shape/HeightFieldShape.h:156</see>
|
|
/// <br/>
|
|
/// <c>const PhysicsMaterial * GetMaterial(uint inX, uint inY) const</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <para>
|
|
/// The returned handle carries its own reference; Dispose it once when you're done.
|
|
/// </para>
|
|
/// </remarks>
|
|
public PhysicsMaterial GetMaterial(uint x, uint y) => Jolt.PInvoke.HeightFieldShape_GetMaterial(this, x, y);
|
|
|
|
/// <inheritdoc cref="Shape.GetSurfaceNormal(uint, float3)"/>
|
|
public float3 GetSurfaceNormal(uint subShapeID, float3 localSurfacePosition) =>
|
|
((Shape)this).GetSurfaceNormal(subShapeID, localSurfacePosition);
|
|
|
|
/// <inheritdoc cref="Shape.GetSupportingFace(uint, float3, float3, in float4x4, out StaticArrayVec3_32)"/>
|
|
public void GetSupportingFace(
|
|
uint subShapeID,
|
|
float3 direction,
|
|
float3 scale,
|
|
in float4x4 centerOfMassTransform,
|
|
out StaticArrayVec3_32 vertices
|
|
) => ((Shape)this).GetSupportingFace(subShapeID, direction, scale, in centerOfMassTransform, out vertices);
|
|
|
|
/// <inheritdoc cref="Shape.GetSubmergedVolume(in float4x4, float3, in Plane, out float, out float, out float3, float3)"/>
|
|
public void GetSubmergedVolume(
|
|
in float4x4 centerOfMassTransform,
|
|
float3 scale,
|
|
in Plane surface,
|
|
out float totalVolume,
|
|
out float submergedVolume,
|
|
out float3 centerOfBuoyancy,
|
|
float3 baseOffset
|
|
) =>
|
|
((Shape)this).GetSubmergedVolume(
|
|
in centerOfMassTransform,
|
|
scale,
|
|
in surface,
|
|
out totalVolume,
|
|
out submergedVolume,
|
|
out centerOfBuoyancy,
|
|
baseOffset
|
|
);
|
|
|
|
/// <inheritdoc cref="Shape.Draw(DebugRenderer, in float4x4, float3, uint, bool, bool)"/>
|
|
public void Draw(
|
|
DebugRenderer renderer,
|
|
in float4x4 centerOfMassTransform,
|
|
float3 scale,
|
|
uint color,
|
|
bool useMaterialColors,
|
|
bool drawWireframe
|
|
) => ((Shape)this).Draw(renderer, in centerOfMassTransform, scale, color, useMaterialColors, drawWireframe);
|
|
|
|
/// <inheritdoc cref="Shape.CastRay(in RayCast, SubShapeIDCreator, ref RayCastResult)"/>
|
|
public bool CastRay(in RayCast ray, SubShapeIDCreator subShapeIDCreator, ref RayCastResult hit) =>
|
|
((Shape)this).CastRay(in ray, subShapeIDCreator, ref hit);
|
|
|
|
/// <inheritdoc cref="Shape.CastRay(in RayCast, RayCastSettings, SubShapeIDCreator, Span{RayCastResult}, out uint, ShapeFilter)"/>
|
|
public unsafe uint CastRay(
|
|
in RayCast ray,
|
|
RayCastSettings rayCastSettings,
|
|
SubShapeIDCreator subShapeIDCreator,
|
|
Span<RayCastResult> results,
|
|
out uint totalHits,
|
|
ShapeFilter shapeFilter = default
|
|
) => ((Shape)this).CastRay(in ray, rayCastSettings, subShapeIDCreator, results, out totalHits, shapeFilter);
|
|
|
|
/// <inheritdoc cref="Shape.CastRayClosest(in RayCast, RayCastSettings, SubShapeIDCreator, out RayCastResult, ShapeFilter)"/>
|
|
public bool CastRayClosest(
|
|
in RayCast ray,
|
|
RayCastSettings rayCastSettings,
|
|
SubShapeIDCreator subShapeIDCreator,
|
|
out RayCastResult result,
|
|
ShapeFilter shapeFilter = default
|
|
) => ((Shape)this).CastRayClosest(in ray, rayCastSettings, subShapeIDCreator, out result, shapeFilter);
|
|
|
|
/// <inheritdoc cref="Shape.CollidePoint(float3, SubShapeIDCreator, Span{CollidePointResult}, out uint, ShapeFilter)"/>
|
|
public unsafe uint CollidePoint(
|
|
float3 point,
|
|
SubShapeIDCreator subShapeIDCreator,
|
|
Span<CollidePointResult> results,
|
|
out uint totalHits,
|
|
ShapeFilter shapeFilter = default
|
|
) => ((Shape)this).CollidePoint(point, subShapeIDCreator, results, out totalHits, shapeFilter);
|
|
|
|
/// <inheritdoc cref="Shape.CollideSoftBodyVertices(in float4x4, float3, CollideSoftBodyVertexIterator, uint, int)"/>
|
|
public void CollideSoftBodyVertices(
|
|
in float4x4 centerOfMassTransform,
|
|
float3 scale,
|
|
CollideSoftBodyVertexIterator vertices,
|
|
uint numVertices,
|
|
int collidingShapeIndex
|
|
) =>
|
|
((Shape)this).CollideSoftBodyVertices(
|
|
in centerOfMassTransform,
|
|
scale,
|
|
vertices,
|
|
numVertices,
|
|
collidingShapeIndex
|
|
);
|
|
|
|
/// <inheritdoc cref="Shape.GetTrianglesStart(ref Shape.GetTrianglesContext, in AABox, float3, floatQuat, float3)"/>
|
|
public void GetTrianglesStart(
|
|
ref Shape.GetTrianglesContext context,
|
|
in AABox box,
|
|
float3 positionCOM,
|
|
floatQuat rotation,
|
|
float3 scale
|
|
) => ((Shape)this).GetTrianglesStart(ref context, in box, positionCOM, rotation, scale);
|
|
|
|
/// <inheritdoc cref="Shape.GetTrianglesNext(ref Shape.GetTrianglesContext, int, Ptr{float3}, Ptr{PhysicsMaterial})"/>
|
|
public unsafe int GetTrianglesNext(
|
|
ref Shape.GetTrianglesContext context,
|
|
int maxTrianglesRequested,
|
|
Ptr<float3> triangleVertices,
|
|
Ptr<PhysicsMaterial> materials = default
|
|
) => ((Shape)this).GetTrianglesNext(ref context, maxTrianglesRequested, triangleVertices, materials);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Get height field position at sampled location (inX, inY). where inX and inY are integers in the range
|
|
/// inX e [0, mSampleCount - 1] and inY e [0, mSampleCount - 1].
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/Shape/HeightFieldShape.h#L190">Jolt/Physics/Collision/Shape/HeightFieldShape.h:190</see>
|
|
/// <br/>
|
|
/// <c>Vec3 GetPosition(uint inX, uint inY) const</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public float3 GetPosition(uint x, uint y) => Jolt.PInvoke.HeightFieldShape_GetPosition(this, x, y);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Check if height field at sampled location (inX, inY) has collision (has a hole or not)
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/Shape/HeightFieldShape.h#L193">Jolt/Physics/Collision/Shape/HeightFieldShape.h:193</see>
|
|
/// <br/>
|
|
/// <c>bool IsNoCollision(uint inX, uint inY) const</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public bool IsNoCollision(uint x, uint y) => Jolt.PInvoke.HeightFieldShape_IsNoCollision(this, x, y);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Projects inLocalPosition (a point in the space of the shape) along the Y axis onto the surface and
|
|
/// returns it in outSurfacePosition. When there is no surface position (because of a hole or because the
|
|
/// point is outside the heightfield) the function will return false.
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/Shape/HeightFieldShape.h#L197">Jolt/Physics/Collision/Shape/HeightFieldShape.h:197</see>
|
|
/// <br/>
|
|
/// <c>bool ProjectOntoSurface(Vec3Arg inLocalPosition, Vec3 &outSurfacePosition, SubShapeID &outSubShapeID) const</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public bool ProjectOntoSurface(float3 localPosition, out float3 surfacePosition, out uint subShapeID) =>
|
|
Jolt.PInvoke.HeightFieldShape_ProjectOntoSurface(this, localPosition, out surfacePosition, out subShapeID);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Returns the coordinates of the triangle that a sub shape ID represents
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/Shape/HeightFieldShape.h#L204">Jolt/Physics/Collision/Shape/HeightFieldShape.h:204</see>
|
|
/// <br/>
|
|
/// <c>void GetSubShapeCoordinates(const SubShapeID &inSubShapeID, uint &outX, uint &outY, uint &outTriangleIndex) const</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <code>
|
|
/// Returns the coordinates of the triangle that a sub shape ID represents
|
|
/// @param inSubShapeID The sub shape ID to decode
|
|
/// @param outX X coordinate of the triangle (in the range [0, mSampleCount - 2])
|
|
/// @param outY Y coordinate of the triangle (in the range [0, mSampleCount - 2])
|
|
/// @param outTriangleIndex Triangle within the quad (0 = lower triangle or 1 = upper triangle)
|
|
/// </code>
|
|
/// </remarks>
|
|
public void GetSubShapeCoordinates(uint subShapeID, out uint x, out uint y, out uint triangleIndex) =>
|
|
Jolt.PInvoke.HeightFieldShape_GetSubShapeCoordinates(this, subShapeID, out x, out y, out triangleIndex);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Get the range of height values that this height field can encode. Can be used to determine the allowed
|
|
/// range when setting the height values with SetHeights.
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/Shape/HeightFieldShape.h#L207">Jolt/Physics/Collision/Shape/HeightFieldShape.h:207</see>
|
|
/// <br/>
|
|
/// <c>float GetMinHeightValue() const</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public float GetMinHeightValue() => Jolt.PInvoke.HeightFieldShape_GetMinHeightValue(this);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/Shape/HeightFieldShape.h#L208">Jolt/Physics/Collision/Shape/HeightFieldShape.h:208</see>
|
|
/// <br/>
|
|
/// <c>float GetMaxHeightValue() const</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public float GetMaxHeightValue() => Jolt.PInvoke.HeightFieldShape_GetMaxHeightValue(this);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Get the height values of a block of data. Note that the height values are decompressed so will be
|
|
/// slightly different from what the shape was originally created with.
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/Shape/HeightFieldShape.h#L218">Jolt/Physics/Collision/Shape/HeightFieldShape.h:218</see>
|
|
/// <br/>
|
|
/// <c>void GetHeights(uint inX, uint inY, uint inSizeX, uint inSizeY, float *outHeights, intptr_t inHeightsStride) const</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <code>
|
|
/// Get the height values of a block of data.
|
|
/// Note that the height values are decompressed so will be slightly different from what the shape was originally created with.
|
|
/// @param inX Start X position, must be a multiple of mBlockSize and in the range [0, mSampleCount - 1]
|
|
/// @param inY Start Y position, must be a multiple of mBlockSize and in the range [0, mSampleCount - 1]
|
|
/// @param inSizeX Number of samples in X direction, must be a multiple of mBlockSize and in the range [0, mSampleCount - inX]
|
|
/// @param inSizeY Number of samples in Y direction, must be a multiple of mBlockSize and in the range [0, mSampleCount - inY]
|
|
/// @param outHeights Returned height values, must be at least inSizeX * inSizeY floats. Values are returned in x-major order and can be cNoCollisionValue.
|
|
/// @param inHeightsStride Stride in floats between two consecutive rows of outHeights (can be negative if the data is upside down).
|
|
/// </code>
|
|
/// </remarks>
|
|
public unsafe void GetHeights(uint x, uint y, uint sizeX, uint sizeY, Ptr<float> heights, long heightsStride) =>
|
|
Jolt.PInvoke.HeightFieldShape_GetHeights(this, x, y, sizeX, sizeY, heights, heightsStride);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Set the height values of a block of data. Note that this requires decompressing and recompressing a
|
|
/// border of size mBlockSize in the negative x/y direction so will cause some precision loss. Beware this
|
|
/// can create a race condition if you're running collision queries in parallel. See class documentation for
|
|
/// more information.
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/Shape/HeightFieldShape.h#L231">Jolt/Physics/Collision/Shape/HeightFieldShape.h:231</see>
|
|
/// <br/>
|
|
/// <c>void SetHeights(uint inX, uint inY, uint inSizeX, uint inSizeY, const float *inHeights, intptr_t inHeightsStride, TempAllocator &inAllocator, float inActiveEdgeCosThresholdAngle = 0.996195f)</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <code>
|
|
/// Set the height values of a block of data.
|
|
/// Note that this requires decompressing and recompressing a border of size mBlockSize in the negative x/y direction so will cause some precision loss.
|
|
/// Beware this can create a race condition if you're running collision queries in parallel. See class documentation for more information.
|
|
/// @param inX Start X position, must be a multiple of mBlockSize and in the range [0, mSampleCount - 1]
|
|
/// @param inY Start Y position, must be a multiple of mBlockSize and in the range [0, mSampleCount - 1]
|
|
/// @param inSizeX Number of samples in X direction, must be a multiple of mBlockSize and in the range [0, mSampleCount - inX]
|
|
/// @param inSizeY Number of samples in Y direction, must be a multiple of mBlockSize and in the range [0, mSampleCount - inY]
|
|
/// @param inHeights The new height values to set, must be an array of inSizeX * inSizeY floats, can be cNoCollisionValue. Values outside of the range [GetMinHeightValue(), GetMaxHeightValue()] will be clamped.
|
|
/// @param inHeightsStride Stride in floats between two consecutive rows of inHeights (can be negative if the data is upside down).
|
|
/// @param inAllocator Allocator to use for temporary memory
|
|
/// @param inActiveEdgeCosThresholdAngle 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).
|
|
/// </code>
|
|
/// </remarks>
|
|
public unsafe void SetHeights(
|
|
uint x,
|
|
uint y,
|
|
uint sizeX,
|
|
uint sizeY,
|
|
Ptr<float> heights,
|
|
long heightsStride,
|
|
TempAllocator allocator,
|
|
float activeEdgeCosThresholdAngle = 0.996195f
|
|
) =>
|
|
Jolt.PInvoke.HeightFieldShape_SetHeights(
|
|
this,
|
|
x,
|
|
y,
|
|
sizeX,
|
|
sizeY,
|
|
heights,
|
|
heightsStride,
|
|
allocator,
|
|
activeEdgeCosThresholdAngle
|
|
);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Get the current list of materials, the indices returned by GetMaterials() will index into this list.
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/Shape/HeightFieldShape.h#L234">Jolt/Physics/Collision/Shape/HeightFieldShape.h:234</see>
|
|
/// <br/>
|
|
/// <c>const PhysicsMaterialList & GetMaterialList() const</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> GetMaterialList() =>
|
|
new NativeArray<PhysicsMaterial>(Jolt.PInvoke.HeightFieldShape_GetMaterialList(this));
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Get the material indices of a block of data.
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/Shape/HeightFieldShape.h#L243">Jolt/Physics/Collision/Shape/HeightFieldShape.h:243</see>
|
|
/// <br/>
|
|
/// <c>void GetMaterials(uint inX, uint inY, uint inSizeX, uint inSizeY, uint8 *outMaterials, intptr_t inMaterialsStride) const</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <code>
|
|
/// Get the material indices of a block of data.
|
|
/// @param inX Start X position, must in the range [0, mSampleCount - 1]
|
|
/// @param inY Start Y position, must in the range [0, mSampleCount - 1]
|
|
/// @param inSizeX Number of samples in X direction
|
|
/// @param inSizeY Number of samples in Y direction
|
|
/// @param outMaterials Returned material indices, must be at least inSizeX * inSizeY uint8s. Values are returned in x-major order.
|
|
/// @param inMaterialsStride Stride in uint8s between two consecutive rows of outMaterials (can be negative if the data is upside down).
|
|
/// </code>
|
|
/// </remarks>
|
|
public unsafe void GetMaterials(
|
|
uint x,
|
|
uint y,
|
|
uint sizeX,
|
|
uint sizeY,
|
|
Ptr<byte> materials,
|
|
long materialsStride
|
|
) => Jolt.PInvoke.HeightFieldShape_GetMaterials(this, x, y, sizeX, sizeY, materials, materialsStride);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Set the material indices of a block of data. Beware this can create a race condition if you're running
|
|
/// collision queries in parallel. See class documentation for more information.
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/Shape/HeightFieldShape.h#L256">Jolt/Physics/Collision/Shape/HeightFieldShape.h:256</see>
|
|
/// <br/>
|
|
/// <c>bool SetMaterials(uint inX, uint inY, uint inSizeX, uint inSizeY, const uint8 *inMaterials, intptr_t inMaterialsStride, const PhysicsMaterialList *inMaterialList, TempAllocator &inAllocator)</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <code>
|
|
/// Set the material indices of a block of data.
|
|
/// Beware this can create a race condition if you're running collision queries in parallel. See class documentation for more information.
|
|
/// @param inX Start X position, must in the range [0, mSampleCount - 1]
|
|
/// @param inY Start Y position, must in the range [0, mSampleCount - 1]
|
|
/// @param inSizeX Number of samples in X direction
|
|
/// @param inSizeY Number of samples in Y direction
|
|
/// @param inMaterials The new material indices, must be at least inSizeX * inSizeY uint8s. Values are returned in x-major order.
|
|
/// @param inMaterialsStride Stride in uint8s between two consecutive rows of inMaterials (can be negative if the data is upside down).
|
|
/// @param inMaterialList The material list to use for the new material indices or nullptr if the material list should not be updated
|
|
/// @param inAllocator Allocator to use for temporary memory
|
|
/// @return True if the material indices were set, false if the total number of materials exceeded 256
|
|
/// </code>
|
|
/// <para>
|
|
/// An empty materialList passes nullptr, which the callee reads as not given; otherwise it is copied into a
|
|
/// native container for the call.
|
|
/// </para>
|
|
/// </remarks>
|
|
public unsafe bool SetMaterials(
|
|
uint x,
|
|
uint y,
|
|
uint sizeX,
|
|
uint sizeY,
|
|
Ptr<byte> materials,
|
|
long materialsStride,
|
|
ReadOnlySpan<PhysicsMaterial> materialList,
|
|
TempAllocator allocator
|
|
)
|
|
{
|
|
fixed (PhysicsMaterial* materialList_fixed = materialList)
|
|
{
|
|
return Jolt.PInvoke.HeightFieldShape_SetMaterials(
|
|
this,
|
|
x,
|
|
y,
|
|
sizeX,
|
|
sizeY,
|
|
materials,
|
|
materialsStride,
|
|
materialList_fixed,
|
|
(nuint)materialList.Length,
|
|
allocator
|
|
);
|
|
}
|
|
}
|
|
|
|
/// <inheritdoc cref="Shape.SaveBinaryState(StreamOut)"/>
|
|
public void SaveBinaryState(StreamOut stream) => ((Shape)this).SaveBinaryState(stream);
|
|
|
|
/// <inheritdoc cref="Shape.SaveMaterialState()"/>
|
|
public NativeArray<PhysicsMaterial> SaveMaterialState() => ((Shape)this).SaveMaterialState();
|
|
|
|
/// <inheritdoc cref="Shape.RestoreMaterialState(ReadOnlySpan{PhysicsMaterial})"/>
|
|
public unsafe void RestoreMaterialState(ReadOnlySpan<PhysicsMaterial> materials) =>
|
|
((Shape)this).RestoreMaterialState(materials);
|
|
|
|
/// <inheritdoc cref="Shape.GetStats()"/>
|
|
public Shape.Stats GetStats() => ((Shape)this).GetStats();
|
|
|
|
/// <inheritdoc cref="Shape.GetVolume()"/>
|
|
public float GetVolume() => ((Shape)this).GetVolume();
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Register shape functions with the registry
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/Shape/HeightFieldShape.h#L275">Jolt/Physics/Collision/Shape/HeightFieldShape.h:275</see>
|
|
/// <br/>
|
|
/// <c>static void sRegister()</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public static void Register() => Jolt.PInvoke.HeightFieldShape_Register();
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Settings
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/Shape/HeightFieldShape.h#L271">Jolt/Physics/Collision/Shape/HeightFieldShape.h:271</see>
|
|
/// <br/>
|
|
/// <c>static bool sDrawTriangleOutlines</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public static bool GetDrawTriangleOutlines() => Jolt.PInvoke.HeightFieldShape_GetDrawTriangleOutlines();
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Settings
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/Shape/HeightFieldShape.h#L271">Jolt/Physics/Collision/Shape/HeightFieldShape.h:271</see>
|
|
/// <br/>
|
|
/// <c>static bool sDrawTriangleOutlines</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public static void SetDrawTriangleOutlines(bool value) =>
|
|
Jolt.PInvoke.HeightFieldShape_SetDrawTriangleOutlines(value);
|
|
|
|
public void AddRef() => ((Shape)this).AddRef();
|
|
|
|
public void Release() => ((Shape)this).Release();
|
|
|
|
public uint GetRefCount() => ((Shape)this).GetRefCount();
|
|
|
|
public static implicit operator Shape(HeightFieldShape value) => Unsafe.BitCast<HeightFieldShape, Shape>(value);
|
|
|
|
public void Dispose()
|
|
{
|
|
if (IsNull())
|
|
return;
|
|
Release();
|
|
}
|
|
|
|
/// <inheritdoc cref="Shape.GetShapeType()"/>
|
|
public ShapeType GetShapeType() => ((Shape)this).GetShapeType();
|
|
|
|
/// <inheritdoc cref="Shape.GetSubType()"/>
|
|
public ShapeSubType GetSubType() => ((Shape)this).GetSubType();
|
|
|
|
/// <inheritdoc cref="Shape.GetUserData()"/>
|
|
public ulong GetUserData() => ((Shape)this).GetUserData();
|
|
|
|
/// <inheritdoc cref="Shape.SetUserData(ulong)"/>
|
|
public void SetUserData(ulong userData) => ((Shape)this).SetUserData(userData);
|
|
|
|
/// <inheritdoc cref="Shape.GetCenterOfMass()"/>
|
|
public float3 GetCenterOfMass() => ((Shape)this).GetCenterOfMass();
|
|
|
|
/// <inheritdoc cref="Shape.GetWorldSpaceBounds(in float4x4, float3)"/>
|
|
public AABox GetWorldSpaceBounds(in float4x4 centerOfMassTransform, float3 scale) =>
|
|
((Shape)this).GetWorldSpaceBounds(in centerOfMassTransform, scale);
|
|
|
|
/// <inheritdoc cref="Shape.GetWorldSpaceBounds(in double4x4, float3)"/>
|
|
public AABox GetWorldSpaceBounds(in double4x4 centerOfMassTransform, float3 scale) =>
|
|
((Shape)this).GetWorldSpaceBounds(in centerOfMassTransform, scale);
|
|
|
|
/// <inheritdoc cref="Shape.GetLeafShape(uint, out uint)"/>
|
|
public Shape GetLeafShape(uint subShapeID, out uint remainder) =>
|
|
((Shape)this).GetLeafShape(subShapeID, out remainder);
|
|
|
|
/// <inheritdoc cref="Shape.GetSubShapeUserData(uint)"/>
|
|
public ulong GetSubShapeUserData(uint subShapeID) => ((Shape)this).GetSubShapeUserData(subShapeID);
|
|
|
|
/// <inheritdoc cref="Shape.GetSubShapeTransformedShape(uint, float3, floatQuat, float3, out uint)"/>
|
|
public TransformedShape GetSubShapeTransformedShape(
|
|
uint subShapeID,
|
|
float3 positionCOM,
|
|
floatQuat rotation,
|
|
float3 scale,
|
|
out uint remainder
|
|
) => ((Shape)this).GetSubShapeTransformedShape(subShapeID, positionCOM, rotation, scale, out remainder);
|
|
|
|
/// <inheritdoc cref="Shape.DrawGetSupportFunction(DebugRenderer, in float4x4, float3, uint, bool)"/>
|
|
public void DrawGetSupportFunction(
|
|
DebugRenderer renderer,
|
|
in float4x4 centerOfMassTransform,
|
|
float3 scale,
|
|
uint color,
|
|
bool drawSupportDirection
|
|
) =>
|
|
((Shape)this).DrawGetSupportFunction(
|
|
renderer,
|
|
in centerOfMassTransform,
|
|
scale,
|
|
color,
|
|
drawSupportDirection
|
|
);
|
|
|
|
/// <inheritdoc cref="Shape.DrawGetSupportingFace(DebugRenderer, in float4x4, float3)"/>
|
|
public void DrawGetSupportingFace(DebugRenderer renderer, in float4x4 centerOfMassTransform, float3 scale) =>
|
|
((Shape)this).DrawGetSupportingFace(renderer, in centerOfMassTransform, scale);
|
|
|
|
/// <inheritdoc cref="Shape.CollectTransformedShapes(in AABox, float3, floatQuat, float3, SubShapeIDCreator, ShapeFilter)"/>
|
|
public NativeHandleArray<TransformedShape> CollectTransformedShapes(
|
|
in AABox box,
|
|
float3 positionCOM,
|
|
floatQuat rotation,
|
|
float3 scale,
|
|
SubShapeIDCreator subShapeIDCreator,
|
|
ShapeFilter shapeFilter
|
|
) =>
|
|
((Shape)this).CollectTransformedShapes(
|
|
in box,
|
|
positionCOM,
|
|
rotation,
|
|
scale,
|
|
subShapeIDCreator,
|
|
shapeFilter
|
|
);
|
|
|
|
/// <inheritdoc cref="Shape.TransformShape(in float4x4)"/>
|
|
public NativeHandleArray<TransformedShape> TransformShape(in float4x4 centerOfMassTransform) =>
|
|
((Shape)this).TransformShape(in centerOfMassTransform);
|
|
|
|
/// <inheritdoc cref="Shape.ScaleShape(float3)"/>
|
|
public Shape ScaleShape(float3 scale) => ((Shape)this).ScaleShape(scale);
|
|
|
|
/// <inheritdoc cref="Shape.SaveSubShapeState()"/>
|
|
public NativeArray<Shape> SaveSubShapeState() => ((Shape)this).SaveSubShapeState();
|
|
|
|
/// <inheritdoc cref="Shape.RestoreSubShapeState(ReadOnlySpan{Shape})"/>
|
|
public unsafe void RestoreSubShapeState(ReadOnlySpan<Shape> subShapes) =>
|
|
((Shape)this).RestoreSubShapeState(subShapes);
|
|
|
|
/// <inheritdoc cref="Shape.SaveWithChildren(StreamOut, ShapeToIDMap, MaterialToIDMap)"/>
|
|
public void SaveWithChildren(StreamOut stream, ShapeToIDMap shapeMap, MaterialToIDMap materialMap) =>
|
|
((Shape)this).SaveWithChildren(stream, shapeMap, materialMap);
|
|
|
|
/// <inheritdoc cref="Shape.IsValidScale(float3)"/>
|
|
public bool IsValidScale(float3 scale) => ((Shape)this).IsValidScale(scale);
|
|
|
|
/// <inheritdoc cref="Shape.MakeScaleValid(float3)"/>
|
|
public float3 MakeScaleValid(float3 scale) => ((Shape)this).MakeScaleValid(scale);
|
|
}
|
|
}
|