PhysX POC Alhamdullah!

This commit is contained in:
bloeys
2022-01-20 04:46:38 +04:00
parent ccecb3a1b0
commit e8bee27262
15 changed files with 268 additions and 52 deletions

19
pgo/physx-c/CExtSimpleFactory.h Executable file
View File

@ -0,0 +1,19 @@
#ifndef CExtSimpleFactory_H
#define CExtSimpleFactory_H
#include "CPxPhysics.h"
#include "CPxGeometry.h"
#include "CPxTransform.h"
#include "CPxRigidDynamic.h"
#ifdef __cplusplus
extern "C" {
#endif
CPxAPI CSTRUCT CPxRigidDynamic* CPxCreateDynamic(CSTRUCT CPxPhysics* sdk, CSTRUCT CPxTransform* transform, CSTRUCT CPxGeometry geometry, CSTRUCT CPxMaterial* material, CPxReal density, CSTRUCT CPxTransform* shapeOffset);
#ifdef __cplusplus
}
#endif
#endif // !CExtSimpleFactory_H

19
pgo/physx-c/CPxBoxGeometry.h Executable file
View File

@ -0,0 +1,19 @@
#ifndef CPxBoxGeometry_H
#define CPxBoxGeometry_H
#ifdef __cplusplus
extern "C" {
#endif
struct CPxBoxGeometry
{
float hx, hy, hz;
};
CPxAPI CPxInline CSTRUCT CPxBoxGeometry NewCPxBoxGeometry(float hx, float hy, float hz);
#ifdef __cplusplus
}
#endif
#endif // !CPxBoxGeometry_H

41
pgo/physx-c/CPxGeometry.h Executable file
View File

@ -0,0 +1,41 @@
#ifndef CPxGeometry_H
#define CPxGeometry_H
#include "CPxBoxGeometry.h"
#include "CPxSphereGeometry.h"
#ifdef __cplusplus
extern "C" {
#endif
enum CPxGeometryType
{
CPxGeometryType_eSPHERE,
CPxGeometryType_ePLANE,
CPxGeometryType_eCAPSULE,
CPxGeometryType_eBOX,
CPxGeometryType_eCONVEXMESH,
CPxGeometryType_eTRIANGLEMESH,
CPxGeometryType_eHEIGHTFIELD,
CPxGeometryType_eGEOMETRY_COUNT, //!< internal use only!
CPxGeometryType_eINVALID = -1 //!< internal use only!
};
struct CPxGeometry
{
void* obj;
CENUM CPxGeometryType type;
};
CPxAPI CPxInline CSTRUCT CPxSphereGeometry CPxGeometry_toCPxSphere(CSTRUCT CPxGeometry);
CPxAPI CPxInline CSTRUCT CPxGeometry CPxSphereGeometry_toCPxGeometry(CSTRUCT CPxSphereGeometry*);
CPxAPI CPxInline CSTRUCT CPxBoxGeometry CPxGeometry_toCPxBox(CSTRUCT CPxGeometry);
CPxAPI CPxInline CSTRUCT CPxGeometry CPxBoxGeometry_toCPxGeometry(CSTRUCT CPxBoxGeometry*);
#ifdef __cplusplus
}
#endif
#endif // !CPxGeometry_H

View File

@ -5,6 +5,7 @@
extern "C" {
#endif
//TODO: Maybe convert this into a value type like CPxSphereGeometry?
struct CPxPlane
{
void* obj;

19
pgo/physx-c/CPxQuat.h Executable file
View File

@ -0,0 +1,19 @@
#ifndef CPxQuat_H
#define CPxQuat_H
#ifdef __cplusplus
extern "C" {
#endif
struct CPxQuat
{
float x, y, z, w;
};
CPxAPI CPxInline CSTRUCT CPxQuat NewCPxQuat(float angleRads, float x, float y, float z);
#ifdef __cplusplus
}
#endif
#endif // !CPxQuat_H

21
pgo/physx-c/CPxRigidDynamic.h Executable file
View File

@ -0,0 +1,21 @@
#ifndef CPxRigidDynamic_H
#define CPxRigidDynamic_H
#include "CPxActor.h"
#ifdef __cplusplus
extern "C" {
#endif
struct CPxRigidDynamic
{
void* obj;
};
CPxAPI CSTRUCT CPxActor CPxRigidDynamic_toCPxActor(CSTRUCT CPxRigidDynamic*);
#ifdef __cplusplus
}
#endif
#endif // !CPxRigidDynamic_H

View File

@ -16,7 +16,7 @@ extern "C" {
};
CPxAPI CSTRUCT CPxRigidStatic* CPxCreatePlane(CSTRUCT CPxPhysics* sdk, CSTRUCT CPxPlane* plane, CSTRUCT CPxMaterial* material);
CPxAPI CSTRUCT CPxActor* CPxRigidStatic_toCPxActor(CSTRUCT CPxRigidStatic*);
CPxAPI CSTRUCT CPxActor CPxRigidStatic_toCPxActor(CSTRUCT CPxRigidStatic*);
#ifdef __cplusplus
}

View File

@ -14,7 +14,7 @@ extern "C" {
};
CPxAPI CSTRUCT CPxPvdSceneClient* CPxScene_getScenePvdClient(CSTRUCT CPxScene*);
CPxAPI void CPxScene_addActor(CSTRUCT CPxScene*, CSTRUCT CPxActor* actor);
CPxAPI void CPxScene_addActor(CSTRUCT CPxScene*, CSTRUCT CPxActor actor);
CPxAPI void CPxScene_simulate(CSTRUCT CPxScene*, CPxReal elapsedTime);
CPxAPI bool CPxScene_fetchResults(CSTRUCT CPxScene*, bool block, CPxU32* errorState);

19
pgo/physx-c/CPxSphereGeometry.h Executable file
View File

@ -0,0 +1,19 @@
#ifndef CPxSphereGeometry_H
#define CPxSphereGeometry_H
#ifdef __cplusplus
extern "C" {
#endif
struct CPxSphereGeometry
{
CPxReal radius;
};
CPxAPI CPxInline CSTRUCT CPxSphereGeometry NewCPxSphereGeometry(CPxReal radius);
#ifdef __cplusplus
}
#endif
#endif // !CPxSphereGeometry_H

23
pgo/physx-c/CPxTransform.h Executable file
View File

@ -0,0 +1,23 @@
#ifndef CPxTransform_H
#define CPxTransform_H
#include "CPxVec3.h"
#include "CPxQuat.h"
#ifdef __cplusplus
extern "C" {
#endif
struct CPxTransform
{
CSTRUCT CPxVec3 p;
CSTRUCT CPxQuat q;
};
CPxAPI CPxInline CSTRUCT CPxTransform NewCPxTransform(CSTRUCT CPxVec3*, CSTRUCT CPxQuat*);
#ifdef __cplusplus
}
#endif
#endif // !CPxTransform_H

View File

@ -9,7 +9,7 @@ extern "C" {
float x, y, z;
};
CPxAPI CSTRUCT CPxVec3 NewCPxVec3(float x, float y, float z);
CPxAPI CPxInline CSTRUCT CPxVec3 NewCPxVec3(float x, float y, float z);
#ifdef __cplusplus
}