PvdSceneClient

This commit is contained in:
bloeys
2022-01-17 19:37:00 +04:00
parent 6fe8f6eba1
commit c3c74b46a4
11 changed files with 161 additions and 1 deletions

View File

@ -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 {
}

Binary file not shown.

View File

@ -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))
}

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

@ -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

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

@ -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

View File

@ -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

20
pgo/physx-c/CPxPlane.h Executable file
View File

@ -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

33
pgo/physx-c/CPxPvdSceneClient.h Executable file
View File

@ -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);
/// <summary>
/// This only releases the C struct
/// </summary>
/// <param name=""></param>
/// <returns></returns>
CPxAPI void CPxPvdSceneClient_release(CSTRUCT CPxPvdSceneClient*);
#ifdef __cplusplus
}
#endif
#endif // !CPxPvdSceneClient_H

25
pgo/physx-c/CPxRigidStatic.h Executable file
View File

@ -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

View File

@ -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

View File

@ -16,3 +16,7 @@
#include <CPxSceneDesc.h>
#include <CPxTolerancesScale.h>
#include <CPxVec3.h>
#include <CPxPlane.h>
#include <CPxActor.h>
#include <CPxRigidStatic.h>
#include <CPxPvdSceneClient.h>