Avoid address-of-temporary warning in btRigidBody_getOrientation
This commit is contained in:
Родитель
5cd77c5062
Коммит
4a16d8a3a7
|
@ -221,7 +221,7 @@ namespace BulletSharp
|
|||
{
|
||||
if (_collisionAlgorithmPool == null)
|
||||
{
|
||||
_collisionAlgorithmPool = new PoolAllocator(btCollisionConfiguration_getCollisionAlgorithmPool(Native), true);
|
||||
_collisionAlgorithmPool = new PoolAllocator(btCollisionConfiguration_getCollisionAlgorithmPool(Native));
|
||||
}
|
||||
return _collisionAlgorithmPool;
|
||||
}
|
||||
|
@ -233,7 +233,7 @@ namespace BulletSharp
|
|||
{
|
||||
if (_persistentManifoldPool == null)
|
||||
{
|
||||
_persistentManifoldPool = new PoolAllocator(btCollisionConfiguration_getPersistentManifoldPool(Native), true);
|
||||
_persistentManifoldPool = new PoolAllocator(btCollisionConfiguration_getPersistentManifoldPool(Native));
|
||||
}
|
||||
return _persistentManifoldPool;
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ using static BulletSharp.UnsafeNativeMethods;
|
|||
|
||||
namespace BulletSharp
|
||||
{
|
||||
public class Element : IDisposable
|
||||
public class Element
|
||||
{
|
||||
internal IntPtr Native;
|
||||
|
||||
|
@ -12,11 +12,6 @@ namespace BulletSharp
|
|||
Native = native;
|
||||
}
|
||||
|
||||
public Element()
|
||||
{
|
||||
Native = btElement_new();
|
||||
}
|
||||
|
||||
public int Id
|
||||
{
|
||||
get => btElement_getId(Native);
|
||||
|
@ -28,29 +23,9 @@ namespace BulletSharp
|
|||
get => btElement_getSz(Native);
|
||||
set => btElement_setSz(Native, value);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
Dispose(true);
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
protected virtual void Dispose(bool disposing)
|
||||
{
|
||||
if (Native != IntPtr.Zero)
|
||||
{
|
||||
btElement_delete(Native);
|
||||
Native = IntPtr.Zero;
|
||||
}
|
||||
}
|
||||
|
||||
~Element()
|
||||
{
|
||||
Dispose(false);
|
||||
}
|
||||
}
|
||||
|
||||
public class UnionFind : IDisposable
|
||||
public class UnionFind
|
||||
{
|
||||
internal IntPtr Native;
|
||||
|
||||
|
@ -59,11 +34,6 @@ namespace BulletSharp
|
|||
Native = native;
|
||||
}
|
||||
|
||||
public UnionFind()
|
||||
{
|
||||
Native = btUnionFind_new();
|
||||
}
|
||||
|
||||
public void Allocate(int n)
|
||||
{
|
||||
btUnionFind_allocate(Native, n);
|
||||
|
@ -110,25 +80,5 @@ namespace BulletSharp
|
|||
}
|
||||
|
||||
public int NumElements => btUnionFind_getNumElements(Native);
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
Dispose(true);
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
protected virtual void Dispose(bool disposing)
|
||||
{
|
||||
if (Native != IntPtr.Zero)
|
||||
{
|
||||
btUnionFind_delete(Native);
|
||||
Native = IntPtr.Zero;
|
||||
}
|
||||
}
|
||||
|
||||
~UnionFind()
|
||||
{
|
||||
Dispose(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,10 +8,10 @@ namespace BulletSharp
|
|||
internal IntPtr _native;
|
||||
private bool _preventDelete;
|
||||
|
||||
internal PoolAllocator(IntPtr native, bool preventDelete)
|
||||
internal PoolAllocator(IntPtr native)
|
||||
{
|
||||
_native = native;
|
||||
_preventDelete = preventDelete;
|
||||
_preventDelete = true;
|
||||
}
|
||||
|
||||
public PoolAllocator(int elemSize, int maxElements)
|
||||
|
|
|
@ -14,10 +14,10 @@ namespace BulletSharp
|
|||
internal IntPtr _native;
|
||||
private bool _preventDelete;
|
||||
|
||||
internal Chunk(IntPtr native, bool preventDelete)
|
||||
internal Chunk(IntPtr native)
|
||||
{
|
||||
_native = native;
|
||||
_preventDelete = preventDelete;
|
||||
_preventDelete = true;
|
||||
}
|
||||
|
||||
public Chunk()
|
||||
|
@ -184,7 +184,7 @@ namespace BulletSharp
|
|||
|
||||
private void FinalizeChunk(IntPtr chunkPtr, string structType, DnaID chunkCode, IntPtr oldPtr)
|
||||
{
|
||||
FinalizeChunk(new Chunk(chunkPtr, true), structType, chunkCode, oldPtr);
|
||||
FinalizeChunk(new Chunk(chunkPtr), structType, chunkCode, oldPtr);
|
||||
}
|
||||
|
||||
private IntPtr GetBufferPointer()
|
||||
|
@ -335,7 +335,7 @@ namespace BulletSharp
|
|||
int length = (int)size * numElements;
|
||||
IntPtr ptr = InternalAlloc(length + ChunkInd.Size);
|
||||
IntPtr data = ptr + ChunkInd.Size;
|
||||
Chunk chunk = new Chunk(ptr, true)
|
||||
var chunk = new Chunk(ptr)
|
||||
{
|
||||
ChunkCode = 0,
|
||||
OldPtr = data,
|
||||
|
|
|
@ -437,7 +437,8 @@ int btRigidBody_getNumConstraintRefs(btRigidBody* obj)
|
|||
|
||||
void btRigidBody_getOrientation(btRigidBody* obj, btQuaternion* value)
|
||||
{
|
||||
BTQUATERNION_SET(value, obj->getOrientation());
|
||||
ATTRIBUTE_ALIGNED16(btQuaternion) temp = obj->getOrientation();
|
||||
BTQUATERNION_SET(value, temp);
|
||||
}
|
||||
|
||||
void btRigidBody_getTotalForce(btRigidBody* obj, btVector3* value)
|
||||
|
|
Загрузка…
Ссылка в новой задаче