-
Notifications
You must be signed in to change notification settings - Fork 0
/
FrameworkGuiHelper.h
113 lines (80 loc) · 6.32 KB
/
FrameworkGuiHelper.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
#pragma once
#include "CommonInterfaces/CommonGUIHelperInterface.h"
struct Common2dCanvasInterface;
struct CommonGraphicsApp;
struct CommonParameterInterface;
struct CommonRenderInterface;
class FrameworkDebugDrawer;
struct FrameworkGUIHelperInterface : GUIHelperInterface
{
FrameworkDebugDrawer * m_debugDraw = nullptr;
CommonGraphicsApp * m_appInterface = nullptr;
CommonRenderInterface * m_renderInterface = nullptr;
CommonParameterInterface * m_parameterInterface = nullptr;
Common2dCanvasInterface * m_2dCanvasInterface = nullptr;
virtual ~FrameworkGUIHelperInterface() override final;
virtual void createRigidBodyGraphicsObject(btRigidBody* body, const btVector3& color) override final;
virtual void createCollisionObjectGraphicsObject(btCollisionObject* obj, const btVector3& color) override final;
virtual void createCollisionShapeGraphicsObject(btCollisionShape* collisionShape) override final;
virtual void syncPhysicsToGraphics(const btDiscreteDynamicsWorld* rbWorld) override final;
virtual void syncPhysicsToGraphics2(const btDiscreteDynamicsWorld* rbWorld) override final;
virtual void syncPhysicsToGraphics2(const GUISyncPosition* positions, int numPositions) override final;
virtual void render(const btDiscreteDynamicsWorld* rbWorld) override final;
virtual void createPhysicsDebugDrawer(btDiscreteDynamicsWorld* rbWorld) override final;
virtual int registerTexture(const unsigned char* texels, int width, int height) override final;
virtual int registerGraphicsShape(const float* vertices, int numvertices, const int* indices, int numIndices, int primitiveType, int textureId) override final;
virtual int registerGraphicsInstance(int shapeId, const float* position, const float* quaternion, const float* color, const float* scaling) override final;
virtual void removeAllGraphicsInstances() override final;
virtual void removeGraphicsInstance(int graphicsId) override final;
virtual void changeRGBAColor(int instanceId, const double rgbaColor[4]) override final;
virtual void changeSpecularColor(int instanceId, const double specularColor[3]) override final;
virtual void changeTexture(int textureUniqueId, const unsigned char* rgbTexels, int width, int height) override final;
virtual int getShapeIndexFromInstance(int instanceId) override final;
virtual void replaceTexture(int shapeId, int textureId) override final;
virtual void removeTexture(int textureId) override final;
virtual Common2dCanvasInterface* get2dCanvasInterface() override final;
virtual CommonParameterInterface* getParameterInterface() override final;
virtual CommonRenderInterface* getRenderInterface() override final;
virtual const CommonRenderInterface* getRenderInterface() const override final;
virtual CommonGraphicsApp* getAppInterface() override final;
virtual void setUpAxis(int axis) override final;
virtual void resetCamera(float camDist, float yaw, float pitch, float camPosX, float camPosY, float camPosZ) override final;
virtual bool getCameraInfo(int* width, int* height, float viewMatrix[16], float projectionMatrix[16], float camUp[3], float camForward[3], float hor[3], float vert[3], float* yaw, float* pitch, float* camDist, float camTarget[3]) const override final;
virtual void setVisualizerFlag(int flag, int enable) override final;
virtual void copyCameraImageData(
const float viewMatrix[16], const float projectionMatrix[16],
unsigned char* pixelsRGBA, int rgbaBufferSizeInPixels,
float* depthBuffer, int depthBufferSizeInPixels,
int startPixelIndex, int destinationWidth, int destinationHeight, int* numPixelsCopied) override final;
virtual void copyCameraImageData(
const float viewMatrix[16], const float projectionMatrix[16],
unsigned char* pixelsRGBA, int rgbaBufferSizeInPixels,
float* depthBuffer, int depthBufferSizeInPixels,
int* segmentationMaskBuffer, int segmentationMaskBufferSizeInPixels,
int startPixelIndex, int destinationWidth, int destinationHeight, int* numPixelsCopied) override final;
virtual void debugDisplayCameraImageData(
const float viewMatrix[16], const float projectionMatrix[16],
unsigned char* pixelsRGBA, int rgbaBufferSizeInPixels,
float* depthBuffer, int depthBufferSizeInPixels,
int* segmentationMaskBuffer, int segmentationMaskBufferSizeInPixels,
int startPixelIndex, int destinationWidth, int destinationHeight, int* numPixelsCopied) override final;
virtual void setProjectiveTextureMatrices(const float viewMatrix[16], const float projectionMatrix[16]) override final;
virtual void setProjectiveTexture(bool useProjectiveTexture) override final;
virtual void autogenerateGraphicsObjects(btDiscreteDynamicsWorld* rbWorld) override final;
virtual void drawText3D(const char* txt, float posX, float posY, float posZ, float size) override final;
virtual void drawText3D(const char* txt, float position[3], float orientation[4], float color[4], float size, int optionFlag) override final;
virtual int addUserDebugText3D(const char* txt, const double positionXYZ[3], const double orientation[4], const double textColorRGB[3], double size, double lifeTime, int trackingVisualShapeIndex, int optionFlags, int replaceItemUid) override final;
virtual int addUserDebugLine(const double debugLineFromXYZ[3], const double debugLineToXYZ[3], const double debugLineColorRGB[3], double lineWidth, double lifeTime, int trackingVisualShapeIndex, int replaceItemUid) override final;
virtual int addUserDebugParameter(const char* txt, double rangeMin, double rangeMax, double startValue) override final;
virtual int readUserDebugParameter(int itemUniqueId, double* value) override final;
virtual void removeUserDebugItem(int debugItemUniqueId) override final;
virtual void removeAllUserDebugItems() override final;
virtual void setVisualizerFlagCallback(VisualizerFlagCallback callback) override final;
virtual void dumpFramesToVideo(const char* mp4FileName) override final;
};
//
class btDiscreteDynamicsWorld;
void createCollisionObjectGraphicsObject(CommonRenderInterface * renderInterface, btCollisionObject * body, const btVector3 & color);
void createCollisionShapeGraphicsObject(CommonRenderInterface * renderInterface, btCollisionShape * collisionShape, const int textureId = -1);
void autogenerateGraphicsObjects(CommonRenderInterface * renderInterface, btDiscreteDynamicsWorld * rbWorld);
void syncPhysicsToGraphics(const btDiscreteDynamicsWorld * rbWorld, CommonRenderInterface * renderInterface);