예제 #1
0
파일: select.py 프로젝트: qtx0213/mcedit2
    def drawSelf(self):
        point = self.sceneNode.point
        if point is None:
            return

        r, g, b, a = self.sceneNode.color
        box = BoundingBox(point, (1, 1, 1))

        with gl.glPushAttrib(GL.GL_DEPTH_BUFFER_BIT | GL.GL_ENABLE_BIT | GL.GL_POLYGON_BIT):
            GL.glDepthMask(False)
            GL.glEnable(GL.GL_BLEND)
            GL.glPolygonOffset(DepthOffsets.SelectionCursor, DepthOffsets.SelectionCursor)

            # Highlighted face

            GL.glPolygonMode(GL.GL_FRONT_AND_BACK, GL.GL_FILL)

            GL.glColor(r, g, b, a)
            cubes.drawFace(box, self.sceneNode.face)

            # Wire box
            GL.glPolygonMode(GL.GL_FRONT_AND_BACK, GL.GL_LINE)

            GL.glLineWidth(3.0)
            GL.glColor(1., 1., 1., a)

            cubes.drawBox(box)

            GL.glLineWidth(1.0)
            GL.glColor(0.2, 0.2, 0.2, a)

            cubes.drawBox(box)
예제 #2
0
파일: select.py 프로젝트: wcpe/mcedit2
    def drawSelf(self):
        point = self.sceneNode.point
        if point is None:
            return

        r, g, b, a = self.sceneNode.color
        box = BoundingBox(point, (1, 1, 1))

        with gl.glPushAttrib(GL.GL_DEPTH_BUFFER_BIT | GL.GL_ENABLE_BIT
                             | GL.GL_POLYGON_BIT):
            GL.glDepthMask(False)
            GL.glEnable(GL.GL_BLEND)
            GL.glPolygonOffset(DepthOffsets.SelectionCursor,
                               DepthOffsets.SelectionCursor)

            # Highlighted face

            GL.glPolygonMode(GL.GL_FRONT_AND_BACK, GL.GL_FILL)

            GL.glColor(r, g, b, a)
            cubes.drawFace(box, self.sceneNode.face)

            # Wire box
            GL.glPolygonMode(GL.GL_FRONT_AND_BACK, GL.GL_LINE)

            GL.glLineWidth(3.0)
            GL.glColor(1., 1., 1., a)

            cubes.drawBox(box)

            GL.glLineWidth(1.0)
            GL.glColor(0.2, 0.2, 0.2, a)

            cubes.drawBox(box)
예제 #3
0
    def drawSelf(self):
        point = self.sceneNode.point
        if point is None:
            return
        selectionColor = map(lambda a: a * a * a * a, self.sceneNode.color)
        r, g, b = selectionColor
        alpha = 0.3
        box = BoundingBox(point, (1, 1, 1))

        with gl.glPushAttrib(GL.GL_DEPTH_BUFFER_BIT | GL.GL_ENABLE_BIT):
            GL.glDepthMask(False)
            GL.glEnable(GL.GL_BLEND)
            GL.glPolygonOffset(DepthOffset.SelectionCursor, DepthOffset.SelectionCursor)

            # Wire box
            GL.glColor(1., 1., 1., alpha)
            cubes.drawBox(box, cubeType=GL.GL_LINES)

            # Highlighted face
            GL.glColor(r, g, b, alpha)
            cubes.drawFace(box, self.sceneNode.face)
예제 #4
0
    def drawSelf(self):
        point = self.sceneNode.point
        if point is None:
            return
        selectionColor = map(lambda a: a * a * a * a, self.sceneNode.color)
        r, g, b = selectionColor
        alpha = 0.3
        box = BoundingBox(point, (1, 1, 1))

        with gl.glPushAttrib(GL.GL_DEPTH_BUFFER_BIT | GL.GL_ENABLE_BIT):
            GL.glDepthMask(False)
            GL.glEnable(GL.GL_BLEND)
            GL.glPolygonOffset(DepthOffset.SelectionCursor, DepthOffset.SelectionCursor)

            # Wire box
            GL.glColor(1., 1., 1., alpha)
            cubes.drawBox(box, cubeType=GL.GL_LINES)

            # Highlighted face
            GL.glColor(r, g, b, alpha)
            cubes.drawFace(box, self.sceneNode.face)
예제 #5
0
    def drawSelf(self):
        box = self.sceneNode.selectionBox
        if box is None:
            return

        r, g, b, alpha = self.sceneNode.color
        with gl.glPushAttrib(GL.GL_DEPTH_BUFFER_BIT | GL.GL_ENABLE_BIT | GL.GL_POLYGON_BIT):
            GL.glDepthMask(False)
            GL.glEnable(GL.GL_BLEND)
            GL.glPolygonOffset(self.sceneNode.depth, self.sceneNode.depth)

            if self.sceneNode.filled:
                # Filled box
                GL.glColor(r, g, b, alpha)
                cubes.drawBox(box)

            if self.sceneNode.wire:
                # Wire box, thinner behind terrain
                r, g, b, alpha = self.sceneNode.wireColor
                GL.glColor(r, g, b, alpha)
                GL.glLineWidth(2.0)
                cubes.drawBox(box, cubeType=GL.GL_LINES)
                GL.glDisable(GL.GL_DEPTH_TEST)
                GL.glLineWidth(1.0)
                cubes.drawBox(box, cubeType=GL.GL_LINES)
예제 #6
0
    def drawSelf(self):
        box = self.sceneNode.selectionBox
        if box is None:
            return

        r, g, b, alpha = self.sceneNode.color
        with gl.glPushAttrib(GL.GL_DEPTH_BUFFER_BIT | GL.GL_ENABLE_BIT
                             | GL.GL_POLYGON_BIT):
            GL.glDepthMask(False)
            GL.glEnable(GL.GL_BLEND)
            GL.glEnable(GL.GL_POLYGON_OFFSET_LINE)
            GL.glPolygonOffset(self.sceneNode.depth, self.sceneNode.depth)

            GL.glPolygonMode(GL.GL_FRONT_AND_BACK, GL.GL_LINE)

            if self.sceneNode.filled:
                # Filled box
                GL.glColor(r, g, b, alpha)
                cubes.drawBox(box)

            if self.sceneNode.wire:
                # Wire box, in front of terrain
                r, g, b, alpha = self.sceneNode.wireColor
                GL.glColor(r, g, b, alpha)
                GL.glLineWidth(3.0)
                cubes.drawBox(box)
                # Wire box, behind terrain, thinner
                GL.glDisable(GL.GL_DEPTH_TEST)
                GL.glColor(r, g, b, alpha * 0.5)
                GL.glLineWidth(1.0)
                cubes.drawBox(box)
예제 #7
0
    def drawSelf(self):
        box = self.sceneNode.selectionBox
        if box is None:
            return

        r, g, b, alpha = self.sceneNode.color
        with gl.glPushAttrib(GL.GL_DEPTH_BUFFER_BIT | GL.GL_ENABLE_BIT | GL.GL_POLYGON_BIT):
            GL.glDepthMask(False)
            GL.glEnable(GL.GL_BLEND)
            GL.glPolygonOffset(self.sceneNode.depth, self.sceneNode.depth)

            if self.sceneNode.filled:
                # Filled box
                GL.glColor(r, g, b, alpha)
                cubes.drawBox(box)

            if self.sceneNode.wire:
                # Wire box, thinner behind terrain
                r, g, b, alpha = self.sceneNode.wireColor
                GL.glColor(r, g, b, alpha)
                GL.glLineWidth(2.0)
                cubes.drawBox(box, cubeType=GL.GL_LINES)
                GL.glDisable(GL.GL_DEPTH_TEST)
                GL.glLineWidth(1.0)
                cubes.drawBox(box, cubeType=GL.GL_LINES)
예제 #8
0
    def drawSelf(self):
        box = self.sceneNode.selectionBox
        if box is None:
            return

        r, g, b, alpha = self.sceneNode.color
        with gl.glPushAttrib(GL.GL_DEPTH_BUFFER_BIT | GL.GL_ENABLE_BIT | GL.GL_POLYGON_BIT):
            GL.glDepthMask(False)
            GL.glEnable(GL.GL_BLEND)
            GL.glEnable(GL.GL_POLYGON_OFFSET_LINE)
            GL.glPolygonOffset(self.sceneNode.depth, self.sceneNode.depth)

            GL.glPolygonMode(GL.GL_FRONT_AND_BACK, GL.GL_LINE)

            if self.sceneNode.filled:
                # Filled box
                GL.glColor(r, g, b, alpha)
                cubes.drawBox(box)

            if self.sceneNode.wire:
                # Wire box, in front of terrain
                r, g, b, alpha = self.sceneNode.wireColor
                GL.glColor(r, g, b, alpha)
                GL.glLineWidth(3.0)
                cubes.drawBox(box)
                # Wire box, behind terrain, thinner
                GL.glDisable(GL.GL_DEPTH_TEST)
                GL.glColor(r, g, b, alpha * 0.5)
                GL.glLineWidth(1.0)
                cubes.drawBox(box)