示例#1
0
    def render(self, camera=None):
        """Render the Image3D
           camera can be None or the camera the scene is using to render from"""
        h, w = self.get_size()

        pos = self.pos

        glPushMatrix()
        glTranslatef(pos[0], pos[1], -pos[2])
        if camera:
            camera.set_facing_matrix()
        glRotatef(self.rotation[0], 1, 0, 0)
        glRotatef(self.rotation[1], 0, 1, 0)
        glRotatef(self.rotation[2], 0, 0, 1)
        try:
            glScalef(self.scale[0], self.scale[1], 1)
        except:
            glScalef(self.scale, self.scale, 1)
        glColor(*self.colorize)
        glDisable(GL_LIGHTING)
        self.texture.bind()
        if self.outline:
            misc.outline(self.display_list, self.outline_color, self.outline_size, True)
        self.display_list.render()
        if view.screen.lighting:
            glEnable(GL_LIGHTING)
        glPopMatrix()
示例#2
0
文件: image.py 项目: PyMine/PyMine
    def render(self, camera=None):
        """Render the Image3D
           camera can be None or the camera the scene is using to render from"""
        h, w = self.get_size()

        pos = self.pos

        glPushMatrix()
        glTranslatef(pos[0], pos[1], -pos[2])
        if camera:
            camera.set_facing_matrix()
        glRotatef(self.rotation[0], 1, 0, 0)
        glRotatef(self.rotation[1], 0, 1, 0)
        glRotatef(self.rotation[2], 0, 0, 1)
        try:
            glScalef(self.scale[0], self.scale[1], 1)
        except:
            glScalef(self.scale, self.scale, 1)
        glColor(*self.colorize)
        glDisable(GL_LIGHTING)
        self.texture.bind()
        if self.outline:
            misc.outline(self.display_list, self.outline_color,
                         self.outline_size, True)
        self.display_list.render()
        if view.screen.lighting:
            glEnable(GL_LIGHTING)
        glPopMatrix()
示例#3
0
 def render(self, camera=None):
     """Render the cube
        camera is None or the camera object the scene is using to render this object"""
     glPushMatrix()
     glColor(*self.colorize)
     self.texture.bind()
     if self.outline:
         misc.outline(self.display_list, self.outline_color, self.outline_size)
     self.display_list.render()
     glPopMatrix()
示例#4
0
文件: mesh.py 项目: PyMine/PyMine
    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()
示例#5
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()
示例#6
0
文件: image.py 项目: PyMine/PyMine
    def render(self, camera=None):
        """Render the image
           camera can be None or the camera the scene is using"""
        if not self.test_on_screen():
            return None

        ox, oy = self.offset
        h, w = self.get_size()

        pos = self.pos

        glPushMatrix()
        glTranslatef(pos[0] + ox, pos[1] + oy, 0)

        glRotatef(self.rotation[0], 1, 0, 0)
        glRotatef(self.rotation[1], 0, 1, 0)
        glRotatef(self.rotation[2], 0, 0, 1)

        try:
            glScalef(self.scale[0], self.scale[1], 1)
        except:
            glScalef(self.scale, self.scale, 1)

        glColor(*self.colorize)
        self.texture.bind()
        if self.outline:
            misc.outline(self.display_list, self.outline_color,
                         self.outline_size, True)
        self.display_list.render()
        glPopMatrix()
        if self.to_be_blitted:
            view.screen.push_clip2d((int(pos[0]), int(pos[1])),
                                    (int(w), int(h)))
            for i in self.to_be_blitted:
                x, y = i[1]
                x += pos[0]
                y += pos[1]
                o = i[0].pos
                i[0].pos = (x, y)
                i[0].render()
                i[0].pos = o
            view.screen.pop_clip()
示例#7
0
文件: geometry.py 项目: AjaxVM/pyggel
 def render(self, camera=None):
     """Render the Sphere
        camera can be None or the camera object 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)
     glColor(*self.colorize)
     self.texture.bind()
     if self.outline:
         misc.outline(self.display_list, self.outline_color, self.outline_size)
     self.display_list.render()
     glPopMatrix()
示例#8
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()
示例#9
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()
示例#10
0
    def render(self, camera=None):
        """Render the image
           camera can be None or the camera the scene is using"""
        if not self.test_on_screen():
            return None

        ox, oy = self.offset
        h, w = self.get_size()

        pos = self.pos

        glPushMatrix()
        glTranslatef(pos[0]+ox, pos[1]+oy, 0)

        glRotatef(self.rotation[0], 1, 0, 0)
        glRotatef(self.rotation[1], 0, 1, 0)
        glRotatef(self.rotation[2], 0, 0, 1)

        try:
            glScalef(self.scale[0], self.scale[1], 1)
        except:
            glScalef(self.scale, self.scale, 1)

        glColor(*self.colorize)
        self.texture.bind()
        if self.outline:
            misc.outline(self.display_list, self.outline_color, self.outline_size, True)
        self.display_list.render()
        glPopMatrix()
        if self.to_be_blitted:
            view.screen.push_clip2d((int(pos[0]), int(pos[1])), (int(w), int(h)))
            for i in self.to_be_blitted:
                x, y = i[1]
                x += pos[0]
                y += pos[1]
                o = i[0].pos
                i[0].pos = (x, y)
                i[0].render()
                i[0].pos = o
            view.screen.pop_clip()
示例#11
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()
示例#12
0
文件: mesh.py 项目: AjaxVM/pyggel
    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)
        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
            r2,g2,b2,a2 = self.colorize
            r *= r2
            g *= g2
            b *= b2
            a = a2
            i.material.color = r,g,b,a
            i.render(camera)
            i.material.color = old
        glPopMatrix()
示例#13
0
文件: mesh.py 项目: PyMine/PyMine
    def render(self, camera=None):
        """Render the object.
           camera must be None of the camera object the scene is using to render."""
        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.outline:
            misc.outline(self.dlist, self.outline_color, self.outline_size)
        glColor4f(*self.material.color)
        self.material.texture.bind()
        self.display_list.render()
        glPopMatrix()
示例#14
0
文件: mesh.py 项目: AjaxVM/pyggel
    def render(self, camera=None):
        """Render the object.
           camera must be None of the camera object the scene is using to render."""
        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.outline:
            misc.outline(self.dlist, self.outline_color, self.outline_size)
        glColor4f(*self.material.color)
        self.material.texture.bind()
        self.display_list.render()
        glPopMatrix()
示例#15
0
文件: geometry.py 项目: AjaxVM/pyggel
 def render(self, camera=None):
     """Render the cube
        camera is None or the camera object the scene is using to render this object"""
     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)
     glScalef(.5*self.size,.5*self.size,.5*self.size)
     try:
         if not self.scale == (1,1,1):
             glScalef(*self.scale)
     except:
         if not self.scale == 1:
             glScalef(self.scale, self.scale, self.scale)
     glColor(*self.colorize)
     self.texture.bind()
     if self.outline:
         misc.outline(self.display_list, self.outline_color, self.outline_size)
     self.display_list.render()
     glPopMatrix()
示例#16
0
 def render(self, camera=None):
     """Render the Sphere
        camera can be None or the camera object 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)
     glScalef(self.size, self.size, self.size)
     try:
         if not self.scale == (1, 1, 1):
             glScalef(*self.scale)
     except:
         if not self.scale == 1:
             glScalef(self.scale, self.scale, self.scale)
     glColor(*self.colorize)
     self.texture.bind()
     if self.outline:
         misc.outline(self.display_list, self.outline_color,
                      self.outline_size)
     self.display_list.render()
     glPopMatrix()
示例#17
0
    def render(self, camera=None):
        """Render the mesh
           camera must be None if 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)
        glColor(*self.colorize)

        if self.outline:
            misc.outline(misc.OutlineGroup([i[0] for i in self.gl_lists]),
                         self.outline_color, self.outline_size)

        for i in self.gl_lists:
            i[1].bind()
            i[0].render()
        glPopMatrix()