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
This commit is contained in:
@@ -22,7 +22,7 @@
|
||||
|
||||
|
||||
#define MAX_ROWS 128
|
||||
#define VERT_COUNT (6*128)
|
||||
#define VERT_COUNT (16*128)
|
||||
#define INDEX_COUNT (VERT_COUNT*2)
|
||||
|
||||
|
||||
@@ -102,6 +102,9 @@ struct sth_texture
|
||||
struct RenderCallbacks
|
||||
{
|
||||
virtual ~RenderCallbacks() {}
|
||||
virtual void setColorRGBA(float color[4])=0;
|
||||
virtual void setWorldPosition(float pos[3])=0;
|
||||
virtual void setWorldOrientation(float orn[4])=0;
|
||||
virtual void updateTexture(sth_texture* texture, sth_glyph* glyph, int textureWidth, int textureHeight)=0;
|
||||
virtual void render(sth_texture* texture)=0;
|
||||
};
|
||||
@@ -124,13 +127,28 @@ void sth_draw_texture(struct sth_stash* stash,
|
||||
int idx, float size,
|
||||
float x, float y,
|
||||
int screenwidth, int screenheight,
|
||||
const char* s, float* dx);
|
||||
const char* s, float* dx, float colorRGBA[4]);
|
||||
|
||||
void sth_flush_draw(struct sth_stash* stash);
|
||||
|
||||
|
||||
void sth_draw_text3D(struct sth_stash* stash,
|
||||
int idx, float fontSize,
|
||||
float x, float y, float z,
|
||||
const char* s, float* dx, float textScale, float colorRGBA[4], int bla);
|
||||
|
||||
void sth_draw_text(struct sth_stash* stash,
|
||||
int idx, float size,
|
||||
float x, float y, const char* string, float* dx, int screenwidth, int screenheight, int measureOnly=0, float retinaScale=1);
|
||||
float x, float y, const char* string, float* dx, int screenwidth, int screenheight, int measureOnly, float retinaScale, float colorRGBA[4]);
|
||||
|
||||
inline void sth_draw_text(struct sth_stash* stash,
|
||||
int idx, float size,
|
||||
float x, float y, const char* string, float* dx, int screenwidth, int screenheight, int measureOnly=false, float retinaScale=1.)
|
||||
{
|
||||
float colorRGBA[4]={1,1,1,1};
|
||||
sth_draw_text(stash,idx,size,x,y,string,dx,screenwidth,screenheight,measureOnly, retinaScale, colorRGBA);
|
||||
|
||||
}
|
||||
|
||||
void sth_dim_text(struct sth_stash* stash, int idx, float size, const char* string,
|
||||
float* minx, float* miny, float* maxx, float* maxy);
|
||||
|
||||
Reference in New Issue
Block a user