2015-04-16 16:55:32 +00:00
|
|
|
#ifndef OPENGL_GUI_HELPER_H
|
|
|
|
#define OPENGL_GUI_HELPER_H
|
2015-04-20 22:28:52 +00:00
|
|
|
#include "../CommonInterfaces/CommonGUIHelperInterface.h"
|
2015-04-16 16:55:32 +00:00
|
|
|
|
|
|
|
class btCollisionShape;
|
|
|
|
class btTransform;
|
|
|
|
#include "LinearMath/btAlignedObjectArray.h"
|
|
|
|
|
|
|
|
struct OpenGLGuiHelper : public GUIHelperInterface
|
|
|
|
{
|
|
|
|
struct OpenGLGuiHelperInternalData* m_data;
|
|
|
|
|
2015-04-20 22:28:52 +00:00
|
|
|
OpenGLGuiHelper(struct CommonGraphicsApp* glApp, bool useOpenGL2);
|
2015-04-16 16:55:32 +00:00
|
|
|
|
|
|
|
virtual ~OpenGLGuiHelper();
|
|
|
|
|
|
|
|
virtual struct CommonRenderInterface* getRenderInterface();
|
2017-04-10 18:03:41 +00:00
|
|
|
virtual const struct CommonRenderInterface* getRenderInterface() const;
|
2015-04-16 16:55:32 +00:00
|
|
|
|
|
|
|
virtual void createRigidBodyGraphicsObject(btRigidBody* body, const btVector3& color);
|
|
|
|
|
|
|
|
virtual void createCollisionObjectGraphicsObject(btCollisionObject* body, const btVector3& color);
|
|
|
|
|
2016-07-08 02:24:44 +00:00
|
|
|
virtual int registerTexture(const unsigned char* texels, int width, int height);
|
|
|
|
virtual int registerGraphicsShape(const float* vertices, int numvertices, const int* indices, int numIndices,int primitiveType, int textureId);
|
2015-04-16 16:55:32 +00:00
|
|
|
virtual int registerGraphicsInstance(int shapeIndex, const float* position, const float* quaternion, const float* color, const float* scaling);
|
2016-07-08 02:24:44 +00:00
|
|
|
virtual void removeAllGraphicsInstances();
|
2017-05-04 00:05:05 +00:00
|
|
|
virtual void removeGraphicsInstance(int graphicsUid);
|
2017-05-13 16:18:36 +00:00
|
|
|
virtual void changeRGBAColor(int instanceUid, const double rgbaColor[4]);
|
2017-06-01 19:32:44 +00:00
|
|
|
virtual void changeSpecularColor(int instanceUid, const double specularColor[3]);
|
2017-07-01 02:11:43 +00:00
|
|
|
virtual void changeTexture(int textureUniqueId, const unsigned char* rgbTexels, int width, int height);
|
2017-06-01 19:32:44 +00:00
|
|
|
|
2017-06-30 20:35:07 +00:00
|
|
|
virtual int getShapeIndexFromInstance(int instanceUid);
|
|
|
|
virtual void replaceTexture(int shapeIndex, int textureUid);
|
|
|
|
|
2015-04-16 16:55:32 +00:00
|
|
|
virtual void createCollisionShapeGraphicsObject(btCollisionShape* collisionShape);
|
|
|
|
|
|
|
|
virtual void syncPhysicsToGraphics(const btDiscreteDynamicsWorld* rbWorld);
|
|
|
|
|
2015-04-20 22:28:52 +00:00
|
|
|
|
|
|
|
virtual void render(const btDiscreteDynamicsWorld* rbWorld);
|
|
|
|
|
2015-04-16 16:55:32 +00:00
|
|
|
virtual void createPhysicsDebugDrawer(btDiscreteDynamicsWorld* rbWorld);
|
|
|
|
|
|
|
|
virtual struct Common2dCanvasInterface* get2dCanvasInterface();
|
|
|
|
|
|
|
|
virtual CommonParameterInterface* getParameterInterface();
|
|
|
|
|
|
|
|
virtual struct CommonGraphicsApp* getAppInterface();
|
|
|
|
|
|
|
|
virtual void setUpAxis(int axis);
|
|
|
|
|
2017-02-22 01:36:54 +00:00
|
|
|
|
2017-06-01 22:30:37 +00:00
|
|
|
virtual void resetCamera(float camDist, float yaw, float pitch, float camPosX,float camPosY, float camPosZ);
|
2017-06-05 05:04:16 +00:00
|
|
|
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 cameraTarget[3]) const;
|
2017-04-10 18:03:41 +00:00
|
|
|
|
2016-08-11 21:55:30 +00:00
|
|
|
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);
|
2015-04-16 16:55:32 +00:00
|
|
|
|
|
|
|
virtual void autogenerateGraphicsObjects(btDiscreteDynamicsWorld* rbWorld) ;
|
Improve debug text/line rendering, can be use to draw frames and text in local coordinate of an object / link.
example:
kuka = p.loadURDF("kuka_iiwa/model.urdf")
p.getNumJoints(kuka)
pybullet.addUserDebugLine([0,0,0],[0,0,0.1],[0,0,1],trackObjectUniqueId=2,trackLinkIndex=6)
pybullet.addUserDebugText("tip", [0,0,0.1],textColorRGB=[1,0,0],trackObjectUniqueId=2,trackLinkIndex=6)
Also allow to render text using a given orientation (instead of pointing to the camera), example:
pybullet.addUserDebugText("tip", [0,0,0.1],textColorRGB=[1,0,0],textOrientation=[0,0,0,1], trackObjectUniqueId=2,trackLinkIndex=6)
Add drawTexturedTriangleMesh, for drawing 3d text.
Expose readSingleInstanceTransformToCPU, to extract position/orientation from graphics index.
updateTexture: allow to not flip texels around up axis
2017-05-24 05:05:26 +00:00
|
|
|
|
|
|
|
virtual void drawText3D( const char* txt, float position[3], float orientation[4], float color[4], float size, int optionFlag);
|
|
|
|
|
|
|
|
virtual void drawText3D( const char* txt, float posX, float posY, float posZ, float size);
|
2015-04-20 22:28:52 +00:00
|
|
|
|
2016-11-14 15:39:34 +00:00
|
|
|
virtual int addUserDebugText3D( const char* txt, const double positionXYZ[3], const double textColorRGB[3], double size, double lifeTime)
|
|
|
|
{
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
virtual int addUserDebugLine(const double debugLineFromXYZ[3], const double debugLineToXYZ[3], const double debugLineColorRGB[3], double lineWidth, double lifeTime )
|
|
|
|
{
|
|
|
|
return -1;
|
|
|
|
}
|
2017-01-17 23:42:32 +00:00
|
|
|
virtual int addUserDebugParameter(const char* txt, double rangeMin, double rangeMax, double startValue)
|
|
|
|
{
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2016-11-14 15:39:34 +00:00
|
|
|
virtual void removeUserDebugItem( int debugItemUniqueId)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
virtual void removeAllUserDebugItems( )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-04-20 22:28:52 +00:00
|
|
|
void renderInternalGl2(int pass, const btDiscreteDynamicsWorld* dynamicsWorld);
|
2016-09-08 22:15:58 +00:00
|
|
|
|
|
|
|
void setVRMode(bool vrMode);
|
2016-11-14 15:39:34 +00:00
|
|
|
|
2017-02-22 03:28:49 +00:00
|
|
|
void setVisualizerFlag(int flag, int enable);
|
|
|
|
|
|
|
|
virtual void setVisualizerFlagCallback(VisualizerFlagCallback callback);
|
2016-11-14 15:39:34 +00:00
|
|
|
|
2017-03-16 16:13:33 +00:00
|
|
|
virtual void dumpFramesToVideo(const char* mp4FileName);
|
|
|
|
|
2017-05-12 05:59:27 +00:00
|
|
|
int createCheckeredTexture(int r,int g, int b);
|
2015-04-16 16:55:32 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif //OPENGL_GUI_HELPER_H
|
|
|
|
|