2015-04-16 16:55:32 +00:00
|
|
|
|
|
|
|
#ifndef SIMPLE_OPENGL2_RENDERER_H
|
|
|
|
#define SIMPLE_OPENGL2_RENDERER_H
|
|
|
|
|
|
|
|
#include "../CommonInterfaces/CommonRenderInterface.h"
|
|
|
|
#include "SimpleCamera.h"
|
|
|
|
|
2017-03-28 04:42:37 +00:00
|
|
|
class SimpleOpenGL2Renderer : public CommonRenderInterface
|
2015-04-16 16:55:32 +00:00
|
|
|
{
|
2017-03-28 04:42:37 +00:00
|
|
|
struct SimpleOpenGL2RendererInternalData* m_data;
|
|
|
|
|
|
|
|
void drawSceneInternal(int pass, int cameraUpAxis);
|
|
|
|
void drawOpenGL(int instanceIndex);
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
2015-04-16 16:55:32 +00:00
|
|
|
SimpleOpenGL2Renderer(int width, int height);
|
2017-03-28 04:42:37 +00:00
|
|
|
virtual ~SimpleOpenGL2Renderer();
|
|
|
|
|
2015-04-16 16:55:32 +00:00
|
|
|
virtual void init();
|
|
|
|
|
|
|
|
virtual void updateCamera(int upAxis);
|
|
|
|
|
2015-04-16 22:16:13 +00:00
|
|
|
virtual const CommonCameraInterface* getActiveCamera() const;
|
|
|
|
virtual CommonCameraInterface* getActiveCamera();
|
|
|
|
virtual void setActiveCamera(CommonCameraInterface* cam);
|
|
|
|
|
2017-04-23 14:35:13 +00:00
|
|
|
virtual void setLightPosition(const float lightPos[3]);
|
|
|
|
virtual void setLightPosition(const double lightPos[3]);
|
|
|
|
|
|
|
|
|
2017-03-28 04:42:37 +00:00
|
|
|
virtual void resize(int width, int height);
|
2015-04-17 06:46:01 +00:00
|
|
|
|
2015-04-16 16:55:32 +00:00
|
|
|
virtual void removeAllInstances();
|
2017-05-04 00:05:05 +00:00
|
|
|
virtual void removeGraphicsInstance(int instanceUid);
|
2015-04-16 16:55:32 +00:00
|
|
|
|
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 bool readSingleInstanceTransformToCPU(float* position, float* orientation, int srcIndex);
|
2017-05-13 16:18:36 +00:00
|
|
|
virtual void writeSingleInstanceColorToCPU(const float* color, int srcIndex);
|
|
|
|
virtual void writeSingleInstanceColorToCPU(const double* color, int srcIndex);
|
|
|
|
virtual void writeSingleInstanceScaleToCPU(const float* scale, int srcIndex);
|
|
|
|
virtual void writeSingleInstanceScaleToCPU(const double* scale, int srcIndex);
|
2017-06-01 19:32:44 +00:00
|
|
|
virtual void writeSingleInstanceSpecularColorToCPU(const double* specular, int srcIndex){}
|
|
|
|
virtual void writeSingleInstanceSpecularColorToCPU(const float* specular, int srcIndex){}
|
|
|
|
|
2015-04-16 16:55:32 +00:00
|
|
|
virtual void getCameraViewMatrix(float viewMat[16]) const;
|
|
|
|
virtual void getCameraProjectionMatrix(float projMat[16]) const;
|
2017-05-24 20:05:16 +00:00
|
|
|
virtual void drawTexturedTriangleMesh(float worldPosition[3], float worldOrientation[4], const float* vertices, int numvertices, const unsigned int* indices, int numIndices, float color[4], int textureIndex=-1, int vertexLayout=0)
|
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
|
|
|
{
|
|
|
|
}
|
2015-04-16 16:55:32 +00:00
|
|
|
|
|
|
|
virtual void renderScene();
|
|
|
|
|
2017-03-28 04:42:37 +00:00
|
|
|
virtual int getScreenWidth();
|
|
|
|
virtual int getScreenHeight();
|
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 int registerTexture(const unsigned char* texels, int width, int height, bool flipTexelsY);
|
|
|
|
virtual void updateTexture(int textureIndex, const unsigned char* texels, bool flipTexelsY);
|
|
|
|
virtual void activateTexture(int textureIndex);
|
2016-04-21 21:10:45 +00:00
|
|
|
|
|
|
|
|
2015-04-16 16:55:32 +00:00
|
|
|
virtual int registerGraphicsInstance(int shapeIndex, const double* position, const double* quaternion, const double* color, const double* scaling);
|
|
|
|
|
|
|
|
virtual int registerGraphicsInstance(int shapeIndex, const float* position, const float* quaternion, const float* color, const float* scaling);
|
|
|
|
|
|
|
|
virtual void drawLines(const float* positions, const float color[4], int numPoints, int pointStrideInBytes, const unsigned int* indices, int numIndices, float pointDrawSize);
|
|
|
|
|
|
|
|
virtual void drawLine(const float from[4], const float to[4], const float color[4], float lineWidth);
|
|
|
|
|
|
|
|
virtual int registerShape(const float* vertices, int numvertices, const int* indices, int numIndices,int primitiveType=B3_GL_TRIANGLES, int textureIndex=-1);
|
|
|
|
|
|
|
|
virtual void writeSingleInstanceTransformToCPU(const float* position, const float* orientation, int srcIndex);
|
|
|
|
|
|
|
|
virtual void writeSingleInstanceTransformToCPU(const double* position, const double* orientation, int srcIndex);
|
|
|
|
|
2016-07-08 02:24:44 +00:00
|
|
|
virtual int getTotalNumInstances() const;
|
|
|
|
|
2015-04-16 16:55:32 +00:00
|
|
|
virtual void writeTransforms();
|
|
|
|
|
|
|
|
virtual void drawLine(const double from[4], const double to[4], const double color[4], double lineWidth);
|
|
|
|
|
|
|
|
virtual void drawPoint(const float* position, const float color[4], float pointDrawSize);
|
|
|
|
|
|
|
|
virtual void drawPoint(const double* position, const double color[4], double pointDrawSize);
|
|
|
|
|
|
|
|
virtual void updateShape(int shapeIndex, const float* vertices);
|
|
|
|
|
2017-06-24 20:41:33 +00:00
|
|
|
|
2015-10-18 21:01:25 +00:00
|
|
|
virtual void clearZBuffer();
|
|
|
|
|
2016-07-08 02:24:44 +00:00
|
|
|
|
2015-05-01 18:42:14 +00:00
|
|
|
virtual struct GLInstanceRendererInternalData* getInternalData()
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
2015-04-16 16:55:32 +00:00
|
|
|
|
|
|
|
};
|
|
|
|
#endif //SIMPLE_OPENGL2_RENDERER_H
|