Cramming PhysX in there
More PhysX work More PhysX work
This commit is contained in:
@@ -0,0 +1 @@
|
||||
#include "PxPhysicsAPI.h"
|
||||
95
modules/PhysX/physx/physx-sys/pxbind/tests/data/enum/flags.h
Normal file
95
modules/PhysX/physx/physx-sys/pxbind/tests/data/enum/flags.h
Normal file
@@ -0,0 +1,95 @@
|
||||
#include "foundation/PxFlags.h"
|
||||
#include "PxArticulationReducedCoordinate.h"
|
||||
|
||||
namespace physx {
|
||||
// From PxActorData.h
|
||||
|
||||
/**
|
||||
\brief Identifies each type of information for retrieving from actor.
|
||||
@see PxScene::applyActorData
|
||||
*/
|
||||
struct PxActorCacheFlag
|
||||
{
|
||||
enum Enum
|
||||
{
|
||||
eACTOR_DATA = (1 << 0), //include transform and velocity
|
||||
eFORCE = (1 << 2),
|
||||
eTORQUE = (1 << 3)
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
\brief Collection of set bits defined in PxActorCacheFlag.
|
||||
|
||||
@see PxActorCacheFlag
|
||||
*/
|
||||
typedef PxFlags<PxActorCacheFlag::Enum, PxU16> PxActorCacheFlags;
|
||||
|
||||
// From PxArticulationFlags.h
|
||||
|
||||
/**
|
||||
\brief Flags which affect the behavior of PxShapes.
|
||||
|
||||
@see PxShape PxShape.setFlag()
|
||||
*/
|
||||
struct PxShapeFlag
|
||||
{
|
||||
enum Enum
|
||||
{
|
||||
/**
|
||||
\brief The shape will partake in collision in the physical simulation.
|
||||
|
||||
\note It is illegal to raise the eSIMULATION_SHAPE and eTRIGGER_SHAPE flags.
|
||||
In the event that one of these flags is already raised the sdk will reject any
|
||||
attempt to raise the other. To raise the eSIMULATION_SHAPE first ensure that
|
||||
eTRIGGER_SHAPE is already lowered.
|
||||
|
||||
\note This flag has no effect if simulation is disabled for the corresponding actor (see #PxActorFlag::eDISABLE_SIMULATION).
|
||||
|
||||
@see PxSimulationEventCallback.onContact() PxScene.setSimulationEventCallback() PxShape.setFlag(), PxShape.setFlags()
|
||||
*/
|
||||
eSIMULATION_SHAPE = (1<<0),
|
||||
|
||||
/**
|
||||
\brief The shape will partake in scene queries (ray casts, overlap tests, sweeps, ...).
|
||||
*/
|
||||
eSCENE_QUERY_SHAPE = (1<<1),
|
||||
|
||||
/**
|
||||
\brief The shape is a trigger which can send reports whenever other shapes enter/leave its volume.
|
||||
|
||||
\note Triangle meshes and heightfields can not be triggers. Shape creation will fail in these cases.
|
||||
|
||||
\note Shapes marked as triggers do not collide with other objects. If an object should act both
|
||||
as a trigger shape and a collision shape then create a rigid body with two shapes, one being a
|
||||
trigger shape and the other a collision shape. It is illegal to raise the eTRIGGER_SHAPE and
|
||||
eSIMULATION_SHAPE flags on a single PxShape instance. In the event that one of these flags is already
|
||||
raised the sdk will reject any attempt to raise the other. To raise the eTRIGGER_SHAPE flag first
|
||||
ensure that eSIMULATION_SHAPE flag is already lowered.
|
||||
|
||||
\note Trigger shapes will no longer send notification events for interactions with other trigger shapes.
|
||||
|
||||
\note Shapes marked as triggers are allowed to participate in scene queries, provided the eSCENE_QUERY_SHAPE flag is set.
|
||||
|
||||
\note This flag has no effect if simulation is disabled for the corresponding actor (see #PxActorFlag::eDISABLE_SIMULATION).
|
||||
|
||||
@see PxSimulationEventCallback.onTrigger() PxScene.setSimulationEventCallback() PxShape.setFlag(), PxShape.setFlags()
|
||||
*/
|
||||
eTRIGGER_SHAPE = (1<<2),
|
||||
|
||||
/**
|
||||
\brief Enable debug renderer for this shape
|
||||
|
||||
@see PxScene.getRenderBuffer() PxRenderBuffer PxVisualizationParameter
|
||||
*/
|
||||
eVISUALIZATION = (1<<3)
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
\brief collection of set bits defined in PxShapeFlag.
|
||||
|
||||
@see PxShapeFlag
|
||||
*/
|
||||
typedef PxFlags<PxShapeFlag::Enum,PxU8> PxShapeFlags;
|
||||
}
|
||||
48
modules/PhysX/physx/physx-sys/pxbind/tests/data/enum/i32.h
Normal file
48
modules/PhysX/physx/physx-sys/pxbind/tests/data/enum/i32.h
Normal file
@@ -0,0 +1,48 @@
|
||||
// From PxBroadPhase.h
|
||||
|
||||
namespace physx {
|
||||
|
||||
/**
|
||||
\brief Broad phase algorithm used in the simulation
|
||||
|
||||
eSAP is a good generic choice with great performance when many objects are sleeping. Performance
|
||||
can degrade significantly though, when all objects are moving, or when large numbers of objects
|
||||
are added to or removed from the broad phase. This algorithm does not need world bounds to be
|
||||
defined in order to work.
|
||||
|
||||
eMBP is an alternative broad phase algorithm that does not suffer from the same performance
|
||||
issues as eSAP when all objects are moving or when inserting large numbers of objects. However
|
||||
its generic performance when many objects are sleeping might be inferior to eSAP, and it requires
|
||||
users to define world bounds in order to work.
|
||||
|
||||
eABP is a revisited implementation of MBP, which automatically manages broad-phase regions.
|
||||
It offers the convenience of eSAP (no need to define world bounds or regions) and the performance
|
||||
of eMBP when a lot of objects are moving. While eSAP can remain faster when most objects are
|
||||
sleeping and eMBP can remain faster when it uses a large number of properly-defined regions,
|
||||
eABP often gives the best performance on average and the best memory usage.
|
||||
|
||||
ePABP is a parallel implementation of ABP. It can often be the fastest (CPU) broadphase, but it
|
||||
can use more memory than ABP.
|
||||
|
||||
eGPU is a GPU implementation of the incremental sweep and prune approach. Additionally, it uses a ABP-style
|
||||
initial pair generation approach to avoid large spikes when inserting shapes. It not only has the advantage
|
||||
of traditional SAP approch which is good for when many objects are sleeping, but due to being fully parallel,
|
||||
it also is great when lots of shapes are moving or for runtime pair insertion and removal. It can become a
|
||||
performance bottleneck if there are a very large number of shapes roughly projecting to the same values
|
||||
on a given axis. If the scene has a very large number of shapes in an actor, e.g. a humanoid, it is recommended
|
||||
to use an aggregate to represent multi-shape or multi-body actors to minimize stress placed on the broad phase.
|
||||
*/
|
||||
struct PxBroadPhaseType
|
||||
{
|
||||
enum Enum
|
||||
{
|
||||
eSAP, //!< 3-axes sweep-and-prune
|
||||
eMBP, //!< Multi box pruning
|
||||
eABP, //!< Automatic box pruning
|
||||
ePABP, //!< Parallel automatic box pruning
|
||||
eGPU, //!< GPU broad phase
|
||||
eLAST
|
||||
};
|
||||
};
|
||||
|
||||
} // physx
|
||||
@@ -0,0 +1,9 @@
|
||||
namespace physx {
|
||||
|
||||
/** enum for empty constructor tag*/
|
||||
enum PxEMPTY
|
||||
{
|
||||
PxEmpty
|
||||
};
|
||||
|
||||
} // physx
|
||||
79
modules/PhysX/physx/physx-sys/pxbind/tests/data/enum/u32.h
Normal file
79
modules/PhysX/physx/physx-sys/pxbind/tests/data/enum/u32.h
Normal file
@@ -0,0 +1,79 @@
|
||||
namespace physx {
|
||||
|
||||
// From PxThread.h
|
||||
|
||||
struct PxThreadPriority
|
||||
{
|
||||
enum Enum
|
||||
{
|
||||
eHIGH = 0, //!< High priority
|
||||
eABOVE_NORMAL = 1, //!< Above Normal priority
|
||||
eNORMAL = 2, //!< Normal/default priority
|
||||
eBELOW_NORMAL = 3, //!< Below Normal priority
|
||||
eLOW = 4, //!< Low priority.
|
||||
eFORCE_DWORD = 0xffFFffFF
|
||||
};
|
||||
};
|
||||
|
||||
// From PxShape.h
|
||||
|
||||
/**
|
||||
\brief Flags which affect the behavior of PxShapes.
|
||||
|
||||
@see PxShape PxShape.setFlag()
|
||||
*/
|
||||
struct PxShapeFlag
|
||||
{
|
||||
enum Enum
|
||||
{
|
||||
/**
|
||||
\brief The shape will partake in collision in the physical simulation.
|
||||
|
||||
\note It is illegal to raise the eSIMULATION_SHAPE and eTRIGGER_SHAPE flags.
|
||||
In the event that one of these flags is already raised the sdk will reject any
|
||||
attempt to raise the other. To raise the eSIMULATION_SHAPE first ensure that
|
||||
eTRIGGER_SHAPE is already lowered.
|
||||
|
||||
\note This flag has no effect if simulation is disabled for the corresponding actor (see #PxActorFlag::eDISABLE_SIMULATION).
|
||||
|
||||
@see PxSimulationEventCallback.onContact() PxScene.setSimulationEventCallback() PxShape.setFlag(), PxShape.setFlags()
|
||||
*/
|
||||
eSIMULATION_SHAPE = (1<<0),
|
||||
|
||||
/**
|
||||
\brief The shape will partake in scene queries (ray casts, overlap tests, sweeps, ...).
|
||||
*/
|
||||
eSCENE_QUERY_SHAPE = (1<<1),
|
||||
|
||||
/**
|
||||
\brief The shape is a trigger which can send reports whenever other shapes enter/leave its volume.
|
||||
|
||||
\note Triangle meshes and heightfields can not be triggers. Shape creation will fail in these cases.
|
||||
|
||||
\note Shapes marked as triggers do not collide with other objects. If an object should act both
|
||||
as a trigger shape and a collision shape then create a rigid body with two shapes, one being a
|
||||
trigger shape and the other a collision shape. It is illegal to raise the eTRIGGER_SHAPE and
|
||||
eSIMULATION_SHAPE flags on a single PxShape instance. In the event that one of these flags is already
|
||||
raised the sdk will reject any attempt to raise the other. To raise the eTRIGGER_SHAPE flag first
|
||||
ensure that eSIMULATION_SHAPE flag is already lowered.
|
||||
|
||||
\note Trigger shapes will no longer send notification events for interactions with other trigger shapes.
|
||||
|
||||
\note Shapes marked as triggers are allowed to participate in scene queries, provided the eSCENE_QUERY_SHAPE flag is set.
|
||||
|
||||
\note This flag has no effect if simulation is disabled for the corresponding actor (see #PxActorFlag::eDISABLE_SIMULATION).
|
||||
|
||||
@see PxSimulationEventCallback.onTrigger() PxScene.setSimulationEventCallback() PxShape.setFlag(), PxShape.setFlags()
|
||||
*/
|
||||
eTRIGGER_SHAPE = (1<<2),
|
||||
|
||||
/**
|
||||
\brief Enable debug renderer for this shape
|
||||
|
||||
@see PxScene.getRenderBuffer() PxRenderBuffer PxVisualizationParameter
|
||||
*/
|
||||
eVISUALIZATION = (1<<3)
|
||||
};
|
||||
};
|
||||
|
||||
} // physx
|
||||
@@ -0,0 +1,106 @@
|
||||
#include "characterkinematic/PxController.h"
|
||||
|
||||
namespace physx {
|
||||
/**
|
||||
\brief Descriptor for a box character controller.
|
||||
|
||||
@see PxBoxController PxControllerDesc
|
||||
*/
|
||||
class PxBoxControllerDesc : public PxControllerDesc
|
||||
{
|
||||
public:
|
||||
/**
|
||||
\brief constructor sets to default.
|
||||
*/
|
||||
PX_INLINE PxBoxControllerDesc();
|
||||
PX_INLINE virtual ~PxBoxControllerDesc() {}
|
||||
|
||||
/**
|
||||
\brief copy constructor.
|
||||
*/
|
||||
PX_INLINE PxBoxControllerDesc(const PxBoxControllerDesc&);
|
||||
|
||||
/**
|
||||
\brief assignment operator.
|
||||
*/
|
||||
PX_INLINE PxBoxControllerDesc& operator=(const PxBoxControllerDesc&);
|
||||
|
||||
/**
|
||||
\brief (re)sets the structure to the default.
|
||||
*/
|
||||
PX_INLINE virtual void setToDefault();
|
||||
|
||||
/**
|
||||
\brief returns true if the current settings are valid
|
||||
|
||||
\return True if the descriptor is valid.
|
||||
*/
|
||||
PX_INLINE virtual bool isValid() const;
|
||||
|
||||
/**
|
||||
\brief Half height
|
||||
|
||||
<b>Default:</b> 1.0
|
||||
*/
|
||||
PxF32 halfHeight; // Half-height in the "up" direction
|
||||
|
||||
/**
|
||||
\brief Half side extent
|
||||
|
||||
<b>Default:</b> 0.5
|
||||
*/
|
||||
PxF32 halfSideExtent; // Half-extent in the "side" direction
|
||||
|
||||
/**
|
||||
\brief Half forward extent
|
||||
|
||||
<b>Default:</b> 0.5
|
||||
*/
|
||||
PxF32 halfForwardExtent; // Half-extent in the "forward" direction
|
||||
|
||||
protected:
|
||||
PX_INLINE void copy(const PxBoxControllerDesc&);
|
||||
};
|
||||
|
||||
PX_INLINE PxBoxControllerDesc::PxBoxControllerDesc() :
|
||||
PxControllerDesc (PxControllerShapeType::eBOX),
|
||||
halfHeight (1.0f),
|
||||
halfSideExtent (0.5f),
|
||||
halfForwardExtent (0.5f)
|
||||
{
|
||||
}
|
||||
|
||||
PX_INLINE PxBoxControllerDesc::PxBoxControllerDesc(const PxBoxControllerDesc& other) : PxControllerDesc(other)
|
||||
{
|
||||
copy(other);
|
||||
}
|
||||
|
||||
PX_INLINE PxBoxControllerDesc& PxBoxControllerDesc::operator=(const PxBoxControllerDesc& other)
|
||||
{
|
||||
PxControllerDesc::operator=(other);
|
||||
copy(other);
|
||||
return *this;
|
||||
}
|
||||
|
||||
PX_INLINE void PxBoxControllerDesc::copy(const PxBoxControllerDesc& other)
|
||||
{
|
||||
halfHeight = other.halfHeight;
|
||||
halfSideExtent = other.halfSideExtent;
|
||||
halfForwardExtent = other.halfForwardExtent;
|
||||
}
|
||||
|
||||
PX_INLINE void PxBoxControllerDesc::setToDefault()
|
||||
{
|
||||
*this = PxBoxControllerDesc();
|
||||
}
|
||||
|
||||
PX_INLINE bool PxBoxControllerDesc::isValid() const
|
||||
{
|
||||
if(!PxControllerDesc::isValid()) return false;
|
||||
if(halfHeight<=0.0f) return false;
|
||||
if(halfSideExtent<=0.0f) return false;
|
||||
if(halfForwardExtent<=0.0f) return false;
|
||||
if(stepOffset>2.0f*halfHeight) return false; // Prevents obvious mistakes
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
#include "common/PxBase.h"
|
||||
#include "foundation/PxMath.h"
|
||||
|
||||
namespace physx {
|
||||
class PxJointLimitParameters
|
||||
{
|
||||
public:
|
||||
PxReal restitution;
|
||||
PxReal bounceThreshold;
|
||||
PxReal stiffness;
|
||||
PxReal damping;
|
||||
PxReal contactDistance_deprecated;
|
||||
|
||||
PxJointLimitParameters() :
|
||||
restitution (0.0f),
|
||||
bounceThreshold (0.0f),
|
||||
stiffness (0.0f),
|
||||
damping (0.0f),
|
||||
contactDistance_deprecated (0.0f)
|
||||
{
|
||||
}
|
||||
|
||||
PxJointLimitParameters(const PxJointLimitParameters& p) :
|
||||
restitution (p.restitution),
|
||||
bounceThreshold (p.bounceThreshold),
|
||||
stiffness (p.stiffness),
|
||||
damping (p.damping),
|
||||
contactDistance_deprecated (p.contactDistance_deprecated)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
\brief Returns true if the current settings are valid.
|
||||
|
||||
\return true if the current settings are valid
|
||||
*/
|
||||
PX_INLINE bool isValid() const
|
||||
{
|
||||
return PxIsFinite(restitution) && restitution >= 0 && restitution <= 1 &&
|
||||
PxIsFinite(stiffness) && stiffness >= 0 &&
|
||||
PxIsFinite(damping) && damping >= 0 &&
|
||||
PxIsFinite(bounceThreshold) && bounceThreshold >= 0 &&
|
||||
PxIsFinite(contactDistance_deprecated) && contactDistance_deprecated >= 0;
|
||||
}
|
||||
|
||||
PX_INLINE bool isSoft() const
|
||||
{
|
||||
return damping>0 || stiffness>0;
|
||||
}
|
||||
|
||||
protected:
|
||||
~PxJointLimitParameters() {}
|
||||
};
|
||||
|
||||
class PxJointAngularLimitPair : public PxJointLimitParameters
|
||||
{
|
||||
public:
|
||||
PxReal upper, lower;
|
||||
|
||||
PxJointAngularLimitPair(PxReal lowerLimit, PxReal upperLimit, PxReal contactDist_deprecated = -1.0f) :
|
||||
upper(upperLimit),
|
||||
lower(lowerLimit)
|
||||
{
|
||||
PxJointLimitParameters::contactDistance_deprecated = contactDist_deprecated ==-1.0f ? PxMin(0.1f, 0.49f*(upperLimit-lowerLimit)) : contactDist_deprecated;
|
||||
bounceThreshold = 0.5f;
|
||||
}
|
||||
|
||||
/**
|
||||
\brief Returns true if the limit is valid.
|
||||
|
||||
\return true if the current settings are valid
|
||||
*/
|
||||
PX_INLINE bool isValid() const
|
||||
{
|
||||
return PxJointLimitParameters::isValid() &&
|
||||
PxIsFinite(upper) && PxIsFinite(lower) && upper >= lower;
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
#include "PxPhysics.h"
|
||||
@@ -0,0 +1 @@
|
||||
#include "PxShape.h"
|
||||
@@ -0,0 +1,50 @@
|
||||
#include <stddef.h>
|
||||
|
||||
namespace physx {
|
||||
|
||||
/**
|
||||
\brief Abstract base class for an application defined memory allocator that can be used by the Nv library.
|
||||
|
||||
\note The SDK state should not be modified from within any allocation/free function.
|
||||
|
||||
<b>Threading:</b> All methods of this class should be thread safe as it can be called from the user thread
|
||||
or the physics processing thread(s).
|
||||
*/
|
||||
|
||||
class PxAllocatorCallback
|
||||
{
|
||||
public:
|
||||
|
||||
virtual ~PxAllocatorCallback()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
\brief Allocates size bytes of memory, which must be 16-byte aligned.
|
||||
|
||||
This method should never return NULL. If you run out of memory, then
|
||||
you should terminate the app or take some other appropriate action.
|
||||
|
||||
<b>Threading:</b> This function should be thread safe as it can be called in the context of the user thread
|
||||
and physics processing thread(s).
|
||||
|
||||
\param size Number of bytes to allocate.
|
||||
\param typeName Name of the datatype that is being allocated
|
||||
\param filename The source file which allocated the memory
|
||||
\param line The source line which allocated the memory
|
||||
\return The allocated block of memory.
|
||||
*/
|
||||
virtual void* allocate(size_t size, const char* typeName, const char* filename, int line) = 0;
|
||||
|
||||
/**
|
||||
\brief Frees memory previously allocated by allocate().
|
||||
|
||||
<b>Threading:</b> This function should be thread safe as it can be called in the context of the user thread
|
||||
and physics processing thread(s).
|
||||
|
||||
\param ptr Memory to free.
|
||||
*/
|
||||
virtual void deallocate(void* ptr) = 0;
|
||||
};
|
||||
|
||||
} // namespace physx
|
||||
@@ -0,0 +1 @@
|
||||
#include "solver/PxSolverDefs.h"
|
||||
@@ -0,0 +1,18 @@
|
||||
namespace physx {
|
||||
|
||||
class PxAllocatorCallback;
|
||||
|
||||
class PxAllocatorCallback
|
||||
{
|
||||
public:
|
||||
|
||||
virtual ~PxAllocatorCallback()
|
||||
{
|
||||
}
|
||||
|
||||
virtual void deallocate(void* ptr) = 0;
|
||||
};
|
||||
|
||||
class MemoryBuffer;
|
||||
|
||||
} // namespace physx
|
||||
@@ -0,0 +1,15 @@
|
||||
#include "common/PxPhysXCommonConfig.h"
|
||||
#include "foundation/PxVecTransform.h"
|
||||
|
||||
|
||||
namespace physx {
|
||||
class PxReffyMcRefface
|
||||
{
|
||||
public:
|
||||
PxVec3 shapeSpaceCenterOfMass;
|
||||
const PxTransform& transform;
|
||||
const PxMat33& vertex2Shape;
|
||||
const PxMat33& shape2Vertex;
|
||||
const bool isIdentityScale;
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
#include "PxQueryReport.h"
|
||||
Reference in New Issue
Block a user