MeshDrawer 2d

I want to draw a line between two points.

Is there a way to set the rotation of a rectangle created by MeshDrawer 2d? ie. Are there additional arguments that can be supplied to the rectangle() method besides x, y, width, and height?

I realize that this can be done with MeshDrawer and segment(), however, it’d be nice if I could use one mesh drawer for all drawing operations.

I don’t know about MeshDrawer, but if all you want is a line between two points, consider LineSegs.

David

Yeah, I’ve considered that. But I want to keep as much as possible in a main draw loop (which currently uses MeshDrawer2D).

I am pretty sure MeshDrawer2D has a tri - draw triangle method. You can use that to draw a line.

I should probably add special line drawing functions because some times one needs to draw lines in UI.

Hmm… If it does, I can’t see it.

Here’s what I get with dir():

[‘DtoolClassDict’, ‘DtoolGetSupperBase’, ‘MeshDrawer2D’, ‘TypedObject’, ‘class’, ‘cmp’, ‘delattr’, ‘doc’, ‘format’, ‘getattribute’, ‘hash’, ‘init’, ‘new’, ‘reduce’, ‘reduce_ex’, ‘repr’, ‘setattr’, ‘sizeof’, ‘str’, ‘subclasshook’, ‘begin’, ‘downcastToTypedReferenceCount’, ‘end’, ‘getBudget’, ‘getClassType’, ‘getRoot’, ‘getType’, ‘getTypeIndex’, ‘isExactType’, ‘isOfType’, ‘quadRaw’, ‘rectangle’, ‘rectangleBorder’, ‘rectangleBorderTiled’, ‘rectangleRaw’, ‘rectangleTiled’, ‘setBudget’, ‘setClip’, ‘this’, ‘this_metatype’]

Oh sorry i forgot it was removed due to meshdraw2d doing everything with quads.

There is quad_raw function you can use.

////////////////////////////////////////////////////////////////////
//     Function: MeshDrawer2D::quad
//       Access: Published
//  Description: Draws a 2d rectangle.
//               Ignores the cliping rectangle
////////////////////////////////////////////////////////////////////
INLINE void MeshDrawer2D::
quad_raw(LVector3f v1, LVector4f c1, LVector2f uv1,
     LVector3f v2, LVector4f c2, LVector2f uv2,
     LVector3f v3, LVector4f c3, LVector2f uv3,
     LVector3f v4, LVector4f c4, LVector2f uv4
) {