diff --git a/main.go b/main.go index 14f919f..7819393 100755 --- a/main.go +++ b/main.go @@ -26,6 +26,13 @@ func main() { s := p.CreateScene(sd) println("Scene:", s) + scenePvdClient := s.GetScenePvdClient() + println("ScenePvdClient:", scenePvdClient) + + scenePvdClient.SetScenePvdFlag(pgo.PvdSceneFlag_eTRANSMIT_CONSTRAINTS, true) + scenePvdClient.SetScenePvdFlag(pgo.PvdSceneFlag_eTRANSMIT_CONTACTS, true) + scenePvdClient.SetScenePvdFlag(pgo.PvdSceneFlag_eTRANSMIT_SCENEQUERIES, true) + for { } diff --git a/pgo/libs/libphysx-c.a b/pgo/libs/libphysx-c.a index b42540a..cac0d89 100755 Binary files a/pgo/libs/libphysx-c.a and b/pgo/libs/libphysx-c.a differ diff --git a/pgo/pgo.go b/pgo/pgo.go index ed7d090..0ed7e1e 100755 --- a/pgo/pgo.go +++ b/pgo/pgo.go @@ -24,6 +24,10 @@ struct CPxPhysics* CPxCreatePhysics(struct CPxFoundation* cfoundation, struct CP struct CPxScene* CPxPhysics_createScene(struct CPxPhysics*, struct CPxSceneDesc*); void CPxPhysics_release(struct CPxPhysics*); +struct CPxPvdSceneClient* CPxScene_getScenePvdClient(struct CPxScene*); + +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); @@ -111,11 +115,16 @@ type Scene struct { cS *C.struct_CPxScene } +func (s *Scene) GetScenePvdClient() *PvdSceneClient { + return &PvdSceneClient{ + cPvdSceneClient: C.CPxScene_getScenePvdClient(s.cS), + } +} + type Physics struct { cPhysics *C.struct_CPxPhysics } -// struct CPxScene* CPxPhysics_createScene(struct CPxPhysics*, struct CPxSceneDesc*); func (p *Physics) CreateScene(sd *SceneDesc) *Scene { return &Scene{ cS: C.CPxPhysics_createScene(p.cPhysics, sd.cSD), @@ -181,3 +190,19 @@ func NewSceneDesc(ts *TolerancesScale) *SceneDesc { cSD: C.NewCPxSceneDesc(ts.cTolScale), } } + +type PvdSceneFlag uint32 + +const ( + PvdSceneFlag_eTRANSMIT_CONTACTS PvdSceneFlag = (1 << 0) //Transmits contact stream to PVD. + PvdSceneFlag_eTRANSMIT_SCENEQUERIES PvdSceneFlag = (1 << 1) //Transmits scene query stream to PVD. + PvdSceneFlag_eTRANSMIT_CONSTRAINTS PvdSceneFlag = (1 << 2) //Transmits constraints visualize stream to PVD. +) + +type PvdSceneClient struct { + cPvdSceneClient *C.struct_CPxPvdSceneClient +} + +func (p *PvdSceneClient) SetScenePvdFlag(flag PvdSceneFlag, value bool) { + C.CPxPvdSceneClient_setScenePvdFlag(p.cPvdSceneClient, uint32(flag), C._Bool(value)) +} diff --git a/pgo/physx-c/CPxActor.h b/pgo/physx-c/CPxActor.h new file mode 100755 index 0000000..e3afb09 --- /dev/null +++ b/pgo/physx-c/CPxActor.h @@ -0,0 +1,19 @@ +#ifndef CPxActor_H +#define CPxActor_H + +#ifdef __cplusplus +extern "C" { +#endif + + struct CPxActor + { + void* obj; + }; + + CPxAPI void CPxActor_release(CSTRUCT CPxActor*); + +#ifdef __cplusplus +} +#endif + +#endif // !CPxActor_H diff --git a/pgo/physx-c/CPxMaterial.h b/pgo/physx-c/CPxMaterial.h new file mode 100755 index 0000000..8c4ef56 --- /dev/null +++ b/pgo/physx-c/CPxMaterial.h @@ -0,0 +1,19 @@ +#ifndef CPxMaterial_H +#define CPxMaterial_H + +#ifdef __cplusplus +extern "C" { +#endif + + struct CPxMaterial + { + void* obj; + }; + + CPxAPI void CPxMaterial_release(CSTRUCT CPxMaterial*); + +#ifdef __cplusplus +} +#endif + +#endif // !CPxMaterial_H diff --git a/pgo/physx-c/CPxPhysics.h b/pgo/physx-c/CPxPhysics.h index 8eeb427..d2c4b80 100755 --- a/pgo/physx-c/CPxPhysics.h +++ b/pgo/physx-c/CPxPhysics.h @@ -5,6 +5,7 @@ #include "CPxFoundation.h" #include "CPxScene.h" #include "CPxSceneDesc.h" +#include "CPxMaterial.h" #include "CPxTolerancesScale.h" #ifdef __cplusplus @@ -17,6 +18,7 @@ extern "C" { CPxAPI CSTRUCT CPxPhysics* CPxCreatePhysics(CSTRUCT CPxFoundation* cfoundation, CSTRUCT CPxTolerancesScale cscale, bool trackOutstandingAllocations, CSTRUCT CPxPvd* cpvd); CPxAPI CSTRUCT CPxScene* CPxPhysics_createScene(CSTRUCT CPxPhysics*, CSTRUCT CPxSceneDesc*); + CPxAPI CSTRUCT CPxMaterial* CPxPhysics_createMaterial(CSTRUCT CPxPhysics*, CPxReal staticFriction, CPxReal dynamicFriction, CPxReal restitution); CPxAPI void CPxPhysics_release(CSTRUCT CPxPhysics*); #ifdef __cplusplus diff --git a/pgo/physx-c/CPxPlane.h b/pgo/physx-c/CPxPlane.h new file mode 100755 index 0000000..19382e2 --- /dev/null +++ b/pgo/physx-c/CPxPlane.h @@ -0,0 +1,20 @@ +#ifndef CPxPlane_H +#define CPxPlane_H + +#ifdef __cplusplus +extern "C" { +#endif + + struct CPxPlane + { + void* obj; + }; + + CPxAPI CSTRUCT CPxPlane* NewCPxPlane(float nx, float ny, float nz, float distance); + CPxAPI void CPxPlane_release(CSTRUCT CPxPlane*); + +#ifdef __cplusplus +} +#endif + +#endif // !CPxPlane_H diff --git a/pgo/physx-c/CPxPvdSceneClient.h b/pgo/physx-c/CPxPvdSceneClient.h new file mode 100755 index 0000000..5a65296 --- /dev/null +++ b/pgo/physx-c/CPxPvdSceneClient.h @@ -0,0 +1,33 @@ +#ifndef CPxPvdSceneClient_H +#define CPxPvdSceneClient_H + +#ifdef __cplusplus +extern "C" { +#endif + + enum CPxPvdSceneFlag + { + CPxPvdSceneFlag_eTRANSMIT_CONTACTS = (1 << 0), //Transmits contact stream to PVD. + CPxPvdSceneFlag_eTRANSMIT_SCENEQUERIES = (1 << 1), //Transmits scene query stream to PVD. + CPxPvdSceneFlag_eTRANSMIT_CONSTRAINTS = (1 << 2) //Transmits constraints visualize stream to PVD. + }; + + struct CPxPvdSceneClient + { + void* obj; + }; + + CPxAPI void CPxPvdSceneClient_setScenePvdFlag(CSTRUCT CPxPvdSceneClient* c, CENUM CPxPvdSceneFlag flag, bool value); + + /// + /// This only releases the C struct + /// + /// + /// + CPxAPI void CPxPvdSceneClient_release(CSTRUCT CPxPvdSceneClient*); + +#ifdef __cplusplus +} +#endif + +#endif // !CPxPvdSceneClient_H diff --git a/pgo/physx-c/CPxRigidStatic.h b/pgo/physx-c/CPxRigidStatic.h new file mode 100755 index 0000000..6fd37d9 --- /dev/null +++ b/pgo/physx-c/CPxRigidStatic.h @@ -0,0 +1,25 @@ +#ifndef CPxRigidStatic_H +#define CPxRigidStatic_H + +#include "CPxPhysics.h" +#include "CPxPlane.h" +#include "CPxMaterial.h" +#include "CPxActor.h" + +#ifdef __cplusplus +extern "C" { +#endif + + struct CPxRigidStatic + { + void* obj; + }; + + CPxAPI CSTRUCT CPxRigidStatic* CPxCreatePlane(CSTRUCT CPxPhysics* sdk, CSTRUCT CPxPlane* plane, CSTRUCT CPxMaterial* material); + CPxAPI CSTRUCT CPxActor* CPxRigidStatic_toCPxActor(CSTRUCT CPxRigidStatic*); + +#ifdef __cplusplus +} +#endif + +#endif // !CPxRigidStatic_H diff --git a/pgo/physx-c/CPxScene.h b/pgo/physx-c/CPxScene.h index deea264..d441619 100755 --- a/pgo/physx-c/CPxScene.h +++ b/pgo/physx-c/CPxScene.h @@ -1,6 +1,9 @@ #ifndef CPxScene_H #define CPxScene_H +#include "CPxPvdSceneClient.h" +#include "CPxActor.h" + #ifdef __cplusplus extern "C" { #endif @@ -10,6 +13,9 @@ extern "C" { void* obj; }; + CPxAPI CSTRUCT CPxPvdSceneClient* CPxScene_getScenePvdClient(CSTRUCT CPxScene*); + CPxAPI void CPxScene_addActor(CSTRUCT CPxScene*, CSTRUCT CPxActor* actor); + CPxAPI void CPxScene_release(CSTRUCT CPxScene*); #ifdef __cplusplus diff --git a/pgo/wrap.cxx b/pgo/wrap.cxx index 36265ec..ebf42a9 100755 --- a/pgo/wrap.cxx +++ b/pgo/wrap.cxx @@ -16,3 +16,7 @@ #include #include #include +#include +#include +#include +#include