From e8bee2726273067b03a01630ab43e0a6fe71026a Mon Sep 17 00:00:00 2001 From: bloeys Date: Thu, 20 Jan 2022 04:46:38 +0400 Subject: [PATCH] PhysX POC Alhamdullah! --- main.go | 20 +++++- pgo/libs/libphysx-c.a | Bin 9384 -> 11670 bytes pgo/pgo.go | 124 ++++++++++++++++++++------------ pgo/physx-c/CExtSimpleFactory.h | 19 +++++ pgo/physx-c/CPxBoxGeometry.h | 19 +++++ pgo/physx-c/CPxGeometry.h | 41 +++++++++++ pgo/physx-c/CPxPlane.h | 1 + pgo/physx-c/CPxQuat.h | 19 +++++ pgo/physx-c/CPxRigidDynamic.h | 21 ++++++ pgo/physx-c/CPxRigidStatic.h | 2 +- pgo/physx-c/CPxScene.h | 2 +- pgo/physx-c/CPxSphereGeometry.h | 19 +++++ pgo/physx-c/CPxTransform.h | 23 ++++++ pgo/physx-c/CPxVec3.h | 2 +- pgo/wrap.cxx | 8 ++- 15 files changed, 268 insertions(+), 52 deletions(-) create mode 100755 pgo/physx-c/CExtSimpleFactory.h create mode 100755 pgo/physx-c/CPxBoxGeometry.h create mode 100755 pgo/physx-c/CPxGeometry.h create mode 100755 pgo/physx-c/CPxQuat.h create mode 100755 pgo/physx-c/CPxRigidDynamic.h create mode 100755 pgo/physx-c/CPxSphereGeometry.h create mode 100755 pgo/physx-c/CPxTransform.h diff --git a/main.go b/main.go index aed5a75..d4e1b12 100755 --- a/main.go +++ b/main.go @@ -33,10 +33,28 @@ func main() { scenePvdClient.SetScenePvdFlag(pgo.PvdSceneFlag_eTRANSMIT_CONTACTS, true) scenePvdClient.SetScenePvdFlag(pgo.PvdSceneFlag_eTRANSMIT_SCENEQUERIES, true) + //Add plane pMat := p.CreateMaterial(0.5, 0.5, 0.6) - groundPlane := pgo.CreatePlane(p, pgo.NewPlane(0, 1, 0, 1), pMat) + groundPlane := pgo.CreatePlane(p, pgo.NewPlane(0, 1, 0, 0), pMat) s.AddActor(groundPlane.ToActor()) + //Add dynamic box + v := pgo.NewVec3(0, 10, 0) + q := pgo.NewQuat(0, 0, 1, 0) + tr := pgo.NewTransform(v, q) + + qID := pgo.NewQuat(0, 0, 1, 0) + shapeOffset := pgo.NewTransform(v, qID) + + box := pgo.NewBoxGeometry(0.5, 0.5, 0.5) + dynBox := pgo.CreateDynamic(p, tr, box.ToGeometry(), pMat, 10, shapeOffset) + s.AddActor(dynBox.ToActor()) + + v = pgo.NewVec3(0.5, 12, 0) + tr2 := pgo.NewTransform(v, qID) + dynBox2 := pgo.CreateDynamic(p, tr2, box.ToGeometry(), pMat, 10, shapeOffset) + s.AddActor(dynBox2.ToActor()) + for { s.Simulate(1 / 60.0) a, b := s.FetchResults(true) diff --git a/pgo/libs/libphysx-c.a b/pgo/libs/libphysx-c.a index e75609bc8cfaf4d90244de00e60d8de2bd45ea2a..9a89d38d59ef67c07fa80e236f08e6679ede3638 100755 GIT binary patch literal 11670 zcmcIqYiv}<6+Y%!3`raV25e)mAKqyQa_| zu}pUVoQw4~fFop5Rtqe6kz>jsUFf z23Yq5!1`waYWg^Bm<3?e9^_Pg1%T1Uo1E&70x;S*#;JY;fKkn9PSuA|9;tqYQ`T`#ic|ZGh=bHTEeLftBh}vJ)OZ`^keZT$=J1JB_W`GlasWn~dIY_OPo&!C zIklz$7_~gjsr5R(BehfsLftJ$Z5KIhZU%7a6h4tUGJ@X2CsJpGQ{#H<7g9sFpqKE8 zREzByb)M(ch4o$C(dgcTk;evxqP=?tcMt513_UgwoftcjJ>C_EXte*(fdi%hoD>qg ze(2Fd{rjW6JBN0{?#S`o87G!=dQYTc;|ZoBF+LGB*vQx!&!scbjFWU?S;v#p+5OJ9 zP;^)N_?MmZxRcAA5P~M3K}<~cCbAQ;Tzt&2Xtq~lyIyA`Hkr)X>(v0}mCC0jm-hF| z8>v;Hr9mFue4gi5CuC4VUwSe%9LpurDRas#b*$I!I(l^;l2L=wWQn5g7<>yhuLxF3 zao!lUd2nVG$`4N98asNGeDj*lD`lW^X|J`^$NMB|vDHDe?@S_=G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oG~8eROui8#L?*YJSy*%0& zR_SZ~DRHIZ&4p@?osBMR972q@15N z>wj@0xjDJi>kiQQ$QD{MWO1Tp_Kv}ECpn{gMXTrirBe1>v>a9FShP)iUv>5h_Zx1G zJnNhoeEAEW0&ZU}9Ty4>#!|wOzxbJX6c2qDOFMs0L@%2aB+i&|XtXPy6o*!ZuHD12 zBKkP~f~&h}{|ZkF4+3v*-W#MQ)kW=z`^DyleHl{)nchouc{`4FE|{LeY23zSe>Y`g zJ49>u6@}=To0e>Stw&qHTRN{HR>!+i4EI+SUZqLpOmM?6ZYyG=I0@*s7TRx zxgzSDCvKYu)=92R(Ojh>jy23=_|_pzOO=n(i7Hv_?C;C)9Ycg>s*?0tM0Qr{W0%Z@ c4HhQr3D9))7V4;xh0!7Z%r_5F8m!U&2Fijt8UO$Q diff --git a/pgo/pgo.go b/pgo/pgo.go index d1871c6..ad24011 100755 --- a/pgo/pgo.go +++ b/pgo/pgo.go @@ -6,50 +6,6 @@ package pgo #include #include //Needed for C.free - -//Functions -struct CPxFoundation* CPxCreateFoundation(); -void CPxFoundation_release(struct CPxFoundation*); - -struct CPxPvd* CPxCreatePvd(struct CPxFoundation*); -bool CPxPvd_connect(struct CPxPvd*, struct CPxPvdTransport*, enum CPxPvdInstrumentationFlag); -void CPxPvd_release(struct CPxPvd*); - -struct CPxPvdTransport* CPxDefaultPvdSocketTransportCreate(const char* address, int port, int timeoutMillis); -void CPxPvdTransport_release(struct CPxPvdTransport* cppt); - -struct CPxTolerancesScale NewCPxTolerancesScale(CPxReal length, CPxReal speed); - -//PxPhysics -struct CPxPhysics* CPxCreatePhysics(struct CPxFoundation* cfoundation, struct CPxTolerancesScale cscale, bool trackOutstandingAllocations, struct CPxPvd* cpvd); -struct CPxScene* CPxPhysics_createScene(struct CPxPhysics*, struct CPxSceneDesc*); -struct CPxMaterial* CPxPhysics_createMaterial(struct CPxPhysics*, CPxReal staticFriction, CPxReal dynamicFriction, CPxReal restitution); -void CPxPhysics_release(struct CPxPhysics*); - -//PxScene -struct CPxPvdSceneClient* CPxScene_getScenePvdClient(struct CPxScene*); -void CPxScene_addActor(struct CPxScene*, struct CPxActor* actor); -void CPxScene_simulate(struct CPxScene*, CPxReal elapsedTime); -bool CPxScene_fetchResults(struct CPxScene*, bool block, CPxU32* errorState); - -void CPxPvdSceneClient_setScenePvdFlag(struct CPxPvdSceneClient* c, enum CPxPvdSceneFlag flag, bool value); - -struct CPxVec3 NewCPxVec3(float x, float y, float z); - -struct CPxDefaultCpuDispatcher* CPxDefaultCpuDispatcherCreate(CPxU32 numThreads, CPxU32 affinityMasks); -struct CPxCpuDispatcher* CPxDefaultCpuDispatcher_toCPxCpuDispatcher(struct CPxDefaultCpuDispatcher* cdcd); - -struct CPxSceneDesc* NewCPxSceneDesc(struct CPxTolerancesScale); -void CPxSceneDesc_set_gravity(struct CPxSceneDesc*, struct CPxVec3); -void CPxSceneDesc_set_cpuDispatcher(struct CPxSceneDesc*, struct CPxCpuDispatcher*); - -//Plane -struct CPxPlane* NewCPxPlane(float nx, float ny, float nz, float distance); - -//RigidStatic -struct CPxRigidStatic* CPxCreatePlane(struct CPxPhysics* sdk, struct CPxPlane* plane, struct CPxMaterial* material); -struct CPxActor* CPxRigidStatic_toCPxActor(struct CPxRigidStatic*); - */ import "C" @@ -256,24 +212,98 @@ func NewPlane(nx, ny, nz, distance float32) *Plane { } } +type Quat struct { + cQ C.struct_CPxQuat +} + +// CPxAPI CPxInline CSTRUCT CPxQuat NewCPxQuat(float angleRads, float x, float y, float z); +func NewQuat(angleRads, x, y, z float32) *Quat { + return &Quat{ + cQ: C.NewCPxQuat(C.float(angleRads), C.float(x), C.float(y), C.float(z)), + } +} + +type Transform struct { + cT C.struct_CPxTransform +} + +// struct CPxTransform NewCPxTransform(struct CPxVec3*, struct CPxQuat*); +func NewTransform(v *Vec3, q *Quat) *Transform { + return &Transform{ + cT: C.NewCPxTransform(&v.cV, &q.cQ), + } +} + +type Geometry struct { + cG C.struct_CPxGeometry +} + +type SphereGeometry struct { + cSg C.struct_CPxSphereGeometry +} + +// struct CPxGeometry CPxSphereGeometry_toCPxGeometry(struct CPxSphereGeometry*); +func (sg *SphereGeometry) ToGeometry() *Geometry { + return &Geometry{ + cG: C.CPxSphereGeometry_toCPxGeometry(&sg.cSg), + } +} + +// struct CPxSphereGeometry NewCPxSphereGeometry(CPxReal radius); +func NewSphereGeometry(radius float32) *SphereGeometry { + return &SphereGeometry{ + cSg: C.NewCPxSphereGeometry(C.float(radius)), + } +} + +type BoxGeometry struct { + cBg C.struct_CPxBoxGeometry +} + +func (bg *BoxGeometry) ToGeometry() *Geometry { + return &Geometry{ + cG: C.CPxBoxGeometry_toCPxGeometry(&bg.cBg), + } +} + +func NewBoxGeometry(hx, hy, hz float32) *BoxGeometry { + return &BoxGeometry{ + cBg: C.NewCPxBoxGeometry(C.float(hx), C.float(hy), C.float(hz)), + } +} + type Actor struct { - cA *C.struct_CPxActor + cA C.struct_CPxActor } type RigidStatic struct { cRs *C.struct_CPxRigidStatic } -//struct CPxActor* CPxRigidStatic_toCPxActor(struct CPxRigidStatic*); func (rs *RigidStatic) ToActor() *Actor { return &Actor{ cA: C.CPxRigidStatic_toCPxActor(rs.cRs), } } -// struct CPxRigidStatic* CPxCreatePlane(struct CPxPhysics* sdk, struct CPxPlane* plane, struct CPxMaterial* material); func CreatePlane(p *Physics, plane *Plane, mat *Material) *RigidStatic { return &RigidStatic{ cRs: C.CPxCreatePlane(p.cPhysics, plane.cP, mat.cM), } } + +type RigidDynamic struct { + cRd *C.struct_CPxRigidDynamic +} + +func (rs *RigidDynamic) ToActor() *Actor { + return &Actor{ + cA: C.CPxRigidDynamic_toCPxActor(rs.cRd), + } +} + +func CreateDynamic(p *Physics, t *Transform, g *Geometry, m *Material, density float32, shapeOffset *Transform) *RigidDynamic { + return &RigidDynamic{ + cRd: C.CPxCreateDynamic(p.cPhysics, &t.cT, g.cG, m.cM, C.float(density), &shapeOffset.cT), + } +} diff --git a/pgo/physx-c/CExtSimpleFactory.h b/pgo/physx-c/CExtSimpleFactory.h new file mode 100755 index 0000000..7fc668b --- /dev/null +++ b/pgo/physx-c/CExtSimpleFactory.h @@ -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 diff --git a/pgo/physx-c/CPxBoxGeometry.h b/pgo/physx-c/CPxBoxGeometry.h new file mode 100755 index 0000000..54a7691 --- /dev/null +++ b/pgo/physx-c/CPxBoxGeometry.h @@ -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 \ No newline at end of file diff --git a/pgo/physx-c/CPxGeometry.h b/pgo/physx-c/CPxGeometry.h new file mode 100755 index 0000000..56726a4 --- /dev/null +++ b/pgo/physx-c/CPxGeometry.h @@ -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 \ No newline at end of file diff --git a/pgo/physx-c/CPxPlane.h b/pgo/physx-c/CPxPlane.h index 19382e2..6be53e7 100755 --- a/pgo/physx-c/CPxPlane.h +++ b/pgo/physx-c/CPxPlane.h @@ -5,6 +5,7 @@ extern "C" { #endif + //TODO: Maybe convert this into a value type like CPxSphereGeometry? struct CPxPlane { void* obj; diff --git a/pgo/physx-c/CPxQuat.h b/pgo/physx-c/CPxQuat.h new file mode 100755 index 0000000..3a973ee --- /dev/null +++ b/pgo/physx-c/CPxQuat.h @@ -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 diff --git a/pgo/physx-c/CPxRigidDynamic.h b/pgo/physx-c/CPxRigidDynamic.h new file mode 100755 index 0000000..e37be01 --- /dev/null +++ b/pgo/physx-c/CPxRigidDynamic.h @@ -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 \ No newline at end of file diff --git a/pgo/physx-c/CPxRigidStatic.h b/pgo/physx-c/CPxRigidStatic.h index 6fd37d9..248ec9a 100755 --- a/pgo/physx-c/CPxRigidStatic.h +++ b/pgo/physx-c/CPxRigidStatic.h @@ -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 } diff --git a/pgo/physx-c/CPxScene.h b/pgo/physx-c/CPxScene.h index 7ed75ce..6c39400 100755 --- a/pgo/physx-c/CPxScene.h +++ b/pgo/physx-c/CPxScene.h @@ -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); diff --git a/pgo/physx-c/CPxSphereGeometry.h b/pgo/physx-c/CPxSphereGeometry.h new file mode 100755 index 0000000..6803937 --- /dev/null +++ b/pgo/physx-c/CPxSphereGeometry.h @@ -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 \ No newline at end of file diff --git a/pgo/physx-c/CPxTransform.h b/pgo/physx-c/CPxTransform.h new file mode 100755 index 0000000..a9f01e6 --- /dev/null +++ b/pgo/physx-c/CPxTransform.h @@ -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 \ No newline at end of file diff --git a/pgo/physx-c/CPxVec3.h b/pgo/physx-c/CPxVec3.h index d4ee78d..1ae9197 100755 --- a/pgo/physx-c/CPxVec3.h +++ b/pgo/physx-c/CPxVec3.h @@ -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 } diff --git a/pgo/wrap.cxx b/pgo/wrap.cxx index ebf42a9..6904302 100755 --- a/pgo/wrap.cxx +++ b/pgo/wrap.cxx @@ -1,6 +1,7 @@ #include #include #define CPxAPI +#define CPxInline #define CSTRUCT struct #define CENUM enum #define CPxU32 uint32_t @@ -15,8 +16,13 @@ #include #include #include -#include #include #include #include +#include +#include #include +#include +#include +#include +#include \ No newline at end of file