Example #1
0
    def render(self, camera=None):
        """Render the mesh
           camera must be None of the camera the scene is using"""
        glPushMatrix()
        x, y, z = self.pos
        glTranslatef(x, y, -z)
        a, b, c = self.rotation
        glRotatef(a, 1, 0, 0)
        glRotatef(b, 0, 1, 0)
        glRotatef(c, 0, 0, 1)
        try:
            glScalef(*self.scale)
        except:
            glScalef(self.scale, self.scale, self.scale)
        if self.colorize != False:
            glColor(*self.colorize)

        if self.outline:
            new = []
            for i in self.objs:
                x = i.copy()
                x.material = data.Material("blank")
                x.material.set_color(self.outline_color)
                x.outline = False
                new.append(x)
            misc.outline(misc.OutlineGroup(new), self.outline_color,
                         self.outline_size)

        for i in self.objs:
            old = tuple(i.material.color)
            r, g, b, a = old
            if self.colorize != False:
                r2, g2, b2, a2 = self.colorize
            else:
                r2, g2, b2, a2 = 1, 1, 1, 1

            r *= r2
            g *= g2
            b *= b2
            a = a2
            i.material.color = r, g, b, a
            i.render(camera)
            i.material.color = old
        glPopMatrix()
Example #2
0
 def render(self, camera=None):
     """Render the image."""
     fo = self.font
     glPushMatrix()
     glTranslatef(self.pos[0], self.pos[1], 0)
     a, b, c = self.rotation
     glRotatef(a, 1, 0, 0)
     glRotatef(b, 0, 1, 0)
     glRotatef(c, 0, 0, 1)
     try:
         glScalef(self.scale[0], self.scale[1], 1)
     except:
         glScalef(self.scale, self.scale, 1)
     downdent = 0
     if self.outline:
         misc.outline(misc.OutlineGroup(self.glyphs), self.outline_color,
                      self.outline_size)
     for glyph in self.glyphs:
         glyph.render()
     glPopMatrix()
Example #3
0
 def render(self, camera=None):
     """Render the image."""
     glPushMatrix()
     glTranslatef(self.pos[0], self.pos[1], 0)
     a, b, c = self.rotation
     glRotatef(a, 1, 0, 0)
     glRotatef(b, 0, 1, 0)
     glRotatef(c, 0, 0, 1)
     try:
         glScalef(self.scale[0], self.scale[1], 1)
     except:
         glScalef(self.scale, self.scale, 1)
     if self._compiled:
         g = self._compiled_glyphs
     else:
         g = self.glyphs
     if self.outline:
         misc.outline(misc.OutlineGroup(g), self.outline_color,
                      self.outline_size)
     for glyph in g:
         glyph.render()
     glPopMatrix()