// // Generated by Brutal.Jolt.Generate; do not edit by hand. #nullable enable using Brutal.Interop; using Brutal.Numerics; namespace Brutal.JoltApi { /// /// /// C++: /// Jolt/Physics/Collision/Shape/HeightFieldShape.h:115 ///
/// class HeightFieldShape final : public Shape ///
///
/// /// /// 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. /// /// [InteropHandle] public readonly partial struct HeightFieldShape : IDisposable { /// /// /// C++: /// Jolt/Physics/Collision/Shape/HeightFieldShape.h:337 ///
/// struct alignas(16) RangeBlock ///
///
/// /// /// A block of 2x2 ranges used to form a hierarchical grid, ordered left top, right top, left bottom, right /// bottom /// /// [StructLayout(LayoutKind.Explicit, Size = 16)] public struct RangeBlock { /// /// /// C++: /// Jolt/Physics/Collision/Shape/HeightFieldShape.h:339 ///
/// uint16 mMin[4] ///
///
[FieldOffset(0)] public ushort_4 mMin; /// /// /// C++: /// Jolt/Physics/Collision/Shape/HeightFieldShape.h:340 ///
/// uint16 mMax[4] ///
///
[FieldOffset(8)] public ushort_4 mMax; } /// /// /// C++: /// Jolt/Physics/Collision/Shape/HeightFieldShape.h:121 ///
/// HeightFieldShape() ///
///
/// /// /// Constructor /// /// public static HeightFieldShape Create() => Jolt.PInvoke.HeightFieldShape_Create(); /// /// /// C++: /// Jolt/Physics/Collision/Shape/HeightFieldShape.h:126 ///
/// Ref<HeightFieldShape> Clone() const ///
///
/// /// /// Clone this shape. Can be used to avoid race conditions. See the documentation of this class for more /// information. /// /// public HeightFieldShape Clone() => Jolt.PInvoke.HeightFieldShape_Clone(this); /// /// /// C++: /// Jolt/Physics/Collision/Shape/HeightFieldShape.h:129 ///
/// virtual bool MustBeStatic() const override ///
///
/// /// /// See Shape::MustBeStatic /// /// public bool MustBeStatic() => Jolt.PInvoke.HeightFieldShape_MustBeStatic(this); /// /// /// C++: /// Jolt/Physics/Collision/Shape/HeightFieldShape.h:132 ///
/// inline uint GetSampleCount() const ///
///
/// /// /// Get the size of the height field. Note that this will always be rounded up to the nearest multiple of /// GetBlockSize(). /// /// public uint GetSampleCount() => Jolt.PInvoke.HeightFieldShape_GetSampleCount(this); /// /// /// C++: /// Jolt/Physics/Collision/Shape/HeightFieldShape.h:135 ///
/// inline uint GetBlockSize() const ///
///
/// /// /// Get the size of a block /// /// public uint GetBlockSize() => Jolt.PInvoke.HeightFieldShape_GetBlockSize(this); /// /// /// C++: /// Jolt/Physics/Collision/Shape/HeightFieldShape.h:141 ///
/// virtual uint GetSubShapeIDBitsRecursive() const override ///
///
/// /// /// See Shape::GetSubShapeIDBitsRecursive /// /// public uint GetSubShapeIDBitsRecursive() => Jolt.PInvoke.HeightFieldShape_GetSubShapeIDBitsRecursive(this); /// /// /// C++: /// Jolt/Physics/Collision/Shape/HeightFieldShape.h:144 ///
/// virtual float GetInnerRadius() const override ///
///
/// /// /// See Shape::GetInnerRadius /// /// public float GetInnerRadius() => Jolt.PInvoke.HeightFieldShape_GetInnerRadius(this); /// /// /// C++: /// Jolt/Physics/Collision/Shape/HeightFieldShape.h:150 ///
/// virtual const PhysicsMaterial * GetMaterial(const SubShapeID &inSubShapeID) const override ///
///
/// /// /// See Shape::GetMaterial /// /// public PhysicsMaterial GetMaterial(uint subShapeID) => Jolt.PInvoke.HeightFieldShape_GetMaterial(this, subShapeID); /// /// /// C++: /// Jolt/Physics/Collision/Shape/HeightFieldShape.h:153 ///
/// const PhysicsMaterial * GetMaterial(uint inX, uint inY) const ///
///
/// /// /// Overload to get the material at a particular location /// /// public PhysicsMaterial GetMaterial(uint x, uint y) => Jolt.PInvoke.HeightFieldShape_GetMaterial_2(this, x, y); /// /// /// C++: /// Jolt/Physics/Collision/Shape/HeightFieldShape.h:156 ///
/// virtual Vec3 GetSurfaceNormal(const SubShapeID &inSubShapeID, Vec3Arg inLocalSurfacePosition) const override ///
///
/// /// /// See Shape::GetSurfaceNormal /// /// public float3 GetSurfaceNormal(uint subShapeID, float3 localSurfacePosition) => Jolt.PInvoke.HeightFieldShape_GetSurfaceNormal(this, subShapeID, localSurfacePosition); /// /// /// C++: /// Jolt/Physics/Collision/Shape/HeightFieldShape.h:162 ///
/// virtual void GetSubmergedVolume(Mat44Arg inCenterOfMassTransform, Vec3Arg inScale, const Plane &inSurface, float &outTotalVolume, float &outSubmergedVolume, Vec3 &outCenterOfBuoyancy JPH_IF_DEBUG_RENDERER(, RVec3Arg inBaseOffset)) const override ///
///
/// /// /// See Shape::GetSubmergedVolume /// /// public void GetSubmergedVolume(float4x4 centerOfMassTransform, float3 scale, Plane surface, out float totalVolume, out float submergedVolume, out float3 centerOfBuoyancy, float3 baseOffset) => Jolt.PInvoke.HeightFieldShape_GetSubmergedVolume(this, centerOfMassTransform, scale, surface, out totalVolume, out submergedVolume, out centerOfBuoyancy, baseOffset); /// /// /// C++: /// Jolt/Physics/Collision/Shape/HeightFieldShape.h:166 ///
/// virtual void Draw(DebugRenderer *inRenderer, RMat44Arg inCenterOfMassTransform, Vec3Arg inScale, ColorArg inColor, bool inUseMaterialColors, bool inDrawWireframe) const override ///
///
/// /// /// See Shape::Draw /// /// public void Draw(DebugRenderer renderer, float4x4 centerOfMassTransform, float3 scale, uint color, bool useMaterialColors, bool drawWireframe) => Jolt.PInvoke.HeightFieldShape_Draw(this, renderer, centerOfMassTransform, scale, color, useMaterialColors, drawWireframe); /// /// /// C++: /// Jolt/Physics/Collision/Shape/HeightFieldShape.h:177 ///
/// virtual void CollideSoftBodyVertices(Mat44Arg inCenterOfMassTransform, Vec3Arg inScale, const CollideSoftBodyVertexIterator &inVertices, uint inNumVertices, int inCollidingShapeIndex) const override ///
///
/// /// /// See: Shape::CollideSoftBodyVertices /// /// public void CollideSoftBodyVertices(float4x4 centerOfMassTransform, float3 scale, CollideSoftBodyVertexIterator vertices, uint numVertices, int collidingShapeIndex) => Jolt.PInvoke.HeightFieldShape_CollideSoftBodyVertices(this, centerOfMassTransform, scale, vertices, numVertices, collidingShapeIndex); /// /// /// C++: /// Jolt/Physics/Collision/Shape/HeightFieldShape.h:180 ///
/// virtual void GetTrianglesStart(GetTrianglesContext &ioContext, const AABox &inBox, Vec3Arg inPositionCOM, QuatArg inRotation, Vec3Arg inScale) const override ///
///
/// /// /// See Shape::GetTrianglesStart /// /// public void GetTrianglesStart(ref Shape.GetTrianglesContext context, AABox box, float3 positionCOM, floatQuat rotation, float3 scale) => Jolt.PInvoke.HeightFieldShape_GetTrianglesStart(this, ref context, box, positionCOM, rotation, scale); /// /// /// C++: /// Jolt/Physics/Collision/Shape/HeightFieldShape.h:187 ///
/// Vec3 GetPosition(uint inX, uint inY) const ///
///
/// /// /// 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]. /// /// public float3 GetPosition(uint x, uint y) => Jolt.PInvoke.HeightFieldShape_GetPosition(this, x, y); /// /// /// C++: /// Jolt/Physics/Collision/Shape/HeightFieldShape.h:190 ///
/// bool IsNoCollision(uint inX, uint inY) const ///
///
/// /// /// Check if height field at sampled location (inX, inY) has collision (has a hole or not) /// /// public bool IsNoCollision(uint x, uint y) => Jolt.PInvoke.HeightFieldShape_IsNoCollision(this, x, y); /// /// /// C++: /// Jolt/Physics/Collision/Shape/HeightFieldShape.h:194 ///
/// bool ProjectOntoSurface(Vec3Arg inLocalPosition, Vec3 &outSurfacePosition, SubShapeID &outSubShapeID) const ///
///
/// /// /// 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. /// /// public bool ProjectOntoSurface(float3 localPosition, out float3 surfacePosition, out uint subShapeID) => Jolt.PInvoke.HeightFieldShape_ProjectOntoSurface(this, localPosition, out surfacePosition, out subShapeID); /// /// /// C++: /// Jolt/Physics/Collision/Shape/HeightFieldShape.h:204 ///
/// float GetMinHeightValue() const ///
///
/// /// /// 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. /// /// public float GetMinHeightValue() => Jolt.PInvoke.HeightFieldShape_GetMinHeightValue(this); /// /// /// C++: /// Jolt/Physics/Collision/Shape/HeightFieldShape.h:205 ///
/// float GetMaxHeightValue() const ///
///
public float GetMaxHeightValue() => Jolt.PInvoke.HeightFieldShape_GetMaxHeightValue(this); /// /// /// C++: /// Jolt/Physics/Collision/Shape/HeightFieldShape.h:215 ///
/// void GetHeights(uint inX, uint inY, uint inSizeX, uint inSizeY, float *outHeights, intptr_t inHeightsStride) const ///
///
/// /// /// 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). /// /// public unsafe void GetHeights(uint x, uint y, uint sizeX, uint sizeY, Ptr heights, long heightsStride) => Jolt.PInvoke.HeightFieldShape_GetHeights(this, x, y, sizeX, sizeY, heights, heightsStride); /// /// /// C++: /// Jolt/Physics/Collision/Shape/HeightFieldShape.h:228 ///
/// void SetHeights(uint inX, uint inY, uint inSizeX, uint inSizeY, const float *inHeights, intptr_t inHeightsStride, TempAllocator &inAllocator, float inActiveEdgeCosThresholdAngle = 0.996195f) ///
///
/// /// /// 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). /// /// public unsafe void SetHeights(uint x, uint y, uint sizeX, uint sizeY, Ptr heights, long heightsStride, TempAllocator allocator, float activeEdgeCosThresholdAngle) => Jolt.PInvoke.HeightFieldShape_SetHeights(this, x, y, sizeX, sizeY, heights, heightsStride, allocator, activeEdgeCosThresholdAngle); /// /// /// C++: /// Jolt/Physics/Collision/Shape/HeightFieldShape.h:240 ///
/// void GetMaterials(uint inX, uint inY, uint inSizeX, uint inSizeY, uint8 *outMaterials, intptr_t inMaterialsStride) const ///
///
/// /// /// 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). /// /// public unsafe void GetMaterials(uint x, uint y, uint sizeX, uint sizeY, Ptr materials, long materialsStride) => Jolt.PInvoke.HeightFieldShape_GetMaterials(this, x, y, sizeX, sizeY, materials, materialsStride); /// /// /// C++: /// Jolt/Physics/Collision/Shape/HeightFieldShape.h:256 ///
/// virtual void SaveBinaryState(StreamOut &inStream) const override ///
///
/// /// /// See Shape /// /// public void SaveBinaryState(StreamOut stream) => Jolt.PInvoke.HeightFieldShape_SaveBinaryState(this, stream); /// /// /// C++: /// Jolt/Physics/Collision/Shape/HeightFieldShape.h:264 ///
/// virtual float GetVolume() const override ///
///
/// /// /// See Shape::GetVolume /// /// public float GetVolume() => Jolt.PInvoke.HeightFieldShape_GetVolume(this); /// /// /// C++: /// Jolt/Physics/Collision/Shape/HeightFieldShape.h:272 ///
/// static void sRegister() ///
///
/// /// /// Register shape functions with the registry /// /// public static void sRegister() => Jolt.PInvoke.HeightFieldShape_sRegister(); public void AddRef() => Jolt.PInvoke.HeightFieldShape_AddRef(this); public void Release() => Jolt.PInvoke.HeightFieldShape_Release(this); public uint GetRefCount() => Jolt.PInvoke.HeightFieldShape_GetRefCount(this); public static implicit operator Shape(HeightFieldShape value) => Jolt.PInvoke.HeightFieldShape_AsShape(value); public void Dispose() { if (IsNull()) return; Release(); } } }