def render(self, renderType=RENDER_OBJECT):
     for T in self.Ts:
         if T != None:
             glPushMatrix()
             glMultMatrixf(T.transpose())
             ygh.drawCoordinate(self.totalColor, self.axisLength)
             glPopMatrix()
 def render(self):
     for i in range(len(self.Rs)):
         if self.Rs[i] != None and self.ps[i] != None:
             T = mm.Rp2T(self.Rs[i], self.ps[i])
             glPushMatrix()
             glMultMatrixf(T.transpose())
             ygh.drawCoordinate(self.totalColor, self.axisLength)
             glPopMatrix()
예제 #3
0
 def drawAxis(self):
     #        glBegin(GL_LINES)
     #        glColor3f(1,0,0)
     #        glVertex3f(0.2,0,0)
     #        glVertex3f(0,0,0)
     #        glColor3f(0,1,0)
     #        glVertex3f(0,0.2,0)
     #        glVertex3f(0,0,0)
     #        glColor3f(0,0,1)
     #        glVertex3f(0,0,0.2)
     #        glVertex3f(0,0,0)
     #        glEnd()
     ygh.drawCoordinate((255, 255, 255), self.camera.distance * .08)
 def renderSelectedOdeGeom(self, geom, color):
     if type(geom) == ode.GeomBox:
         lx, ly, lz = geom.getLengths()
         x, y, z = geom.getPosition()
         R = geom.getRotation()
         se3 = [
             R[0], R[3], R[6], 0., R[1], R[4], R[7], 0., R[2], R[5], R[8],
             0., x, y, z, 1.0
         ]
         glPushMatrix()
         glMultMatrixd(se3)
         ygh.drawCoordinate(color)
         glScaled(1.1, 1.1, 1.1)
         glTranslated(-lx / 2., -ly / 2., -lz / 2.)
         self.drawBox(lx, ly, lz)
         glPopMatrix()
    def _renderJoint(self, joint, posture):
        glPushMatrix()
        glTranslatef(joint.offset[0], joint.offset[1], joint.offset[2])
        #        glMultMatrixf(mm.R2T(posture.localRMap[joint.name]).transpose())
        glMultMatrixf(
            mm.R2T(posture.localRs[posture.skeleton.getElementIndex(
                joint.name)]).transpose())

        #        if joint.name in self.partColors:
        #            color = self.partColors[joint.name]
        #        else:
        #            color = self.totalColor

        if joint == self.selectedElement:
            glColor3ubv(SELECTION_COLOR)
            ygh.beginDraw()
            ygh.drawCoordinate()
            ygh.endDraw()

        # 1


#        ygh.drawPoint((0,0,0), color)

        if self.linkStyle == LINK_LINE:
            self.rc.drawPoint((0, 0, 0))
            for childJoint in joint.children:
                self.rc.drawLine((0, 0, 0), childJoint.offset)

        elif self.linkStyle == LINK_BONE:
            #            self.rc.drawPoint((0,0,0))
            self.rc.drawLine((-.05, 0, 0), (.05, 0, 0))
            for childJoint in joint.children:
                self.rc.drawLine((0, 0, 0), childJoint.offset)

        elif self.linkStyle == LINK_SOLIDBOX or self.linkStyle == LINK_WIREBOX:
            if len(joint.children) > 0:
                glPushMatrix()

                offset = numpy.array([0., 0., 0.])
                for childJoint in joint.children:
                    offset += childJoint.offset
                offset = offset / len(joint.children)

                defaultBoneV = numpy.array([0, 0, mm.length(offset)])
                boneT = mm.R2T(mm.getSO3FromVectors(defaultBoneV, offset))
                glMultMatrixf(boneT.transpose())

                glTranslatef(-.05, -.05, 0)
                #                ygh.beginDraw()
                #                ygh.drawCoordinate()
                #                ygh.endDraw()

                self.rc.drawBox(.1, .1, mm.length(offset))
                glPopMatrix()

        if joint == self.selectedElement:
            glColor3ubv(self.totalColor)

        for childJoint in joint.children:
            self._renderJoint(childJoint, posture)
        glPopMatrix()