Exemple #1
0
    def makeChunkVertices(self, chunk, limitBox):
        monsterPositions = []
        for i, entityRef in enumerate(chunk.Entities):
            if i % 10 == 0:
                yield
            ID = entityRef.id

            if ID in self.notMonsters:
                continue
            pos = entityRef.Position
            if limitBox and pos not in limitBox:
                continue
            monsterPositions.append(pos)

        monsters = self._computeVertices(monsterPositions,
                                         (0xff, 0x22, 0x22, 0x44),
                                         offset=True,
                                         chunkPosition=chunk.chunkPosition)
        yield

        vertexNode = VertexNode(monsters)
        polyNode = PolygonModeNode(GL.GL_FRONT_AND_BACK, GL.GL_LINE)
        polyNode.addChild(vertexNode)
        lineNode = LineWidthNode(2.0)
        lineNode.addChild(polyNode)
        depthNode = DepthFuncNode(GL.GL_ALWAYS)
        depthNode.addChild(lineNode)

        self.sceneNode = Node()
        self.sceneNode.addChild(depthNode)

        vertexNode = VertexNode(monsters)
        self.sceneNode.addChild(vertexNode)
Exemple #2
0
    def makeChunkVertices(self, chunk, limitBox):
        tilePositions = []
        defaultColor = (0xff, 0xff, 0x33, 0x44)
        for i, ref in enumerate(chunk.TileEntities):
            if i % 10 == 0:
                yield

            if limitBox and ref.Position not in limitBox:
                continue
            if ref.id == "Control":
                continue
            tilePositions.append(ref.Position)

        tiles = self._computeVertices(tilePositions, defaultColor, chunkPosition=chunk.chunkPosition)

        vertexNode = VertexNode([tiles])
        polyNode = PolygonModeNode(GL.GL_FRONT_AND_BACK, GL.GL_LINE)
        polyNode.addChild(vertexNode)
        lineNode = LineWidthNode(2.0)
        lineNode.addChild(polyNode)
        depthNode = DepthFuncNode(GL.GL_ALWAYS)
        depthNode.addChild(lineNode)

        self.sceneNode = Node()
        self.sceneNode.addChild(depthNode)

        vertexNode = VertexNode([tiles])
        self.sceneNode.addChild(vertexNode)
Exemple #3
0
    def makeChunkVertices(self, chunk, limitBox):
        monsterPositions = []
        for i, entityRef in enumerate(chunk.Entities):
            if i % 10 == 0:
                yield
            ID = entityRef.id

            if ID in self.notMonsters:
                continue
            pos = entityRef.Position
            if limitBox and pos not in limitBox:
                continue
            monsterPositions.append(pos)

        monsters = self._computeVertices(monsterPositions,
                                         (0xff, 0x22, 0x22, 0x44),
                                         offset=True,
                                         chunkPosition=chunk.chunkPosition)
        yield

        vertexNode = VertexNode(monsters)
        polyNode = PolygonModeNode(GL.GL_FRONT_AND_BACK, GL.GL_LINE)
        polyNode.addChild(vertexNode)
        lineNode = LineWidthNode(2.0)
        lineNode.addChild(polyNode)
        depthNode = DepthFuncNode(GL.GL_ALWAYS)
        depthNode.addChild(lineNode)

        self.sceneNode = Node()
        self.sceneNode.addChild(depthNode)

        vertexNode = VertexNode(monsters)
        self.sceneNode.addChild(vertexNode)
Exemple #4
0
    def makeChunkVertices(self, chunk, limitBox):
        tilePositions = []
        defaultColor = (0xff, 0xff, 0x33, 0x44)
        for i, ref in enumerate(chunk.TileEntities):
            if i % 10 == 0:
                yield

            if limitBox and ref.Position not in limitBox:
                continue
            if ref.id == "Control":
                continue
            tilePositions.append(ref.Position)

        tiles = self._computeVertices(tilePositions,
                                      defaultColor,
                                      chunkPosition=chunk.chunkPosition)

        vertexNode = VertexNode([tiles])
        polyNode = PolygonModeNode(GL.GL_FRONT_AND_BACK, GL.GL_LINE)
        polyNode.addChild(vertexNode)
        lineNode = LineWidthNode(2.0)
        lineNode.addChild(polyNode)
        depthNode = DepthFuncNode(GL.GL_ALWAYS)
        depthNode.addChild(lineNode)

        self.sceneNode = Node()
        self.sceneNode.addChild(depthNode)

        vertexNode = VertexNode([tiles])
        self.sceneNode.addChild(vertexNode)
Exemple #5
0
    def makeChunkVertices(self, chunk, limitBox):
        tilePositions = []
        tileColors = []
        defaultColor = (0xff, 0x33, 0x33, 0x44)
        for i, ref in enumerate(chunk.TileEntities):
            if i % 10 == 0:
                yield

            if limitBox and ref.Position not in limitBox:
                continue
            if ref.id == "Control":
                tilePositions.append(ref.Position)
                cmdText = ref.Command
                if len(cmdText):
                    if cmdText[0] == "/":
                        cmdText = cmdText[1:]
                    command, _ = cmdText.split(None, 1)
                    color = commandColor(command)
                    tileColors.append(color + (0x44, ))
                else:
                    tileColors.append(defaultColor)
            else:
                continue

        tiles = self._computeVertices(tilePositions,
                                      tileColors,
                                      chunkPosition=chunk.chunkPosition)

        vertexNode = VertexNode([tiles])
        polyNode = PolygonModeNode(GL.GL_FRONT_AND_BACK, GL.GL_LINE)
        polyNode.addChild(vertexNode)
        lineNode = LineWidthNode(2.0)
        lineNode.addChild(polyNode)
        depthNode = DepthFuncNode(GL.GL_ALWAYS)
        depthNode.addChild(lineNode)

        self.sceneNode = Node()
        self.sceneNode.addChild(depthNode)
Exemple #6
0
    def makeChunkVertices(self, chunk, limitBox):
        tilePositions = []
        tileColors = []
        defaultColor = (0xff, 0x33, 0x33, 0x44)
        for i, ref in enumerate(chunk.TileEntities):
            if i % 10 == 0:
                yield

            if limitBox and ref.Position not in limitBox:
                continue
            if ref.id == "Control":
                tilePositions.append(ref.Position)
                cmdText = ref.Command
                if len(cmdText):
                    if cmdText[0] == "/":
                        cmdText = cmdText[1:]
                    command, _ = cmdText.split(None, 1)
                    color = commandColor(command)
                    tileColors.append(color + (0x44,))
                else:
                    tileColors.append(defaultColor)
            else:
                continue

        tiles = self._computeVertices(tilePositions, tileColors, chunkPosition=chunk.chunkPosition)

        vertexNode = VertexNode([tiles])
        polyNode = PolygonModeNode(GL.GL_FRONT_AND_BACK, GL.GL_LINE)
        polyNode.addChild(vertexNode)
        lineNode = LineWidthNode(2.0)
        lineNode.addChild(polyNode)
        depthNode = DepthFuncNode(GL.GL_ALWAYS)
        depthNode.addChild(lineNode)

        self.sceneNode = Node()
        self.sceneNode.addChild(depthNode)