Exemple #1
0
def renderScene(renderNode):
    with profiler.context("updateRenderNode"):
        updateRenderNode(renderNode)
    with profiler.context("renderNode.compile"):
        renderNode.compile()
    with profiler.context("renderNode.callList"):
        renderNode.callList()
Exemple #2
0
def renderScene(renderNode):
    with profiler.context("updateRenderNode"):
        updateRenderNode(renderNode)
    with profiler.context("renderNode.compile"):
        renderNode.compile()
    with profiler.context("renderNode.callList"):
        renderNode.callList()
Exemple #3
0
    def paintGL(self):
        with profiler.context("paintGL: %s" % self):
            self.frameSamples.append(time.time())
            if self.textureAtlas:
                self.textureAtlas.update()

            with profiler.context("renderScene"):
                rendernode.renderScene(self.renderGraph)
Exemple #4
0
    def paintGL(self):
        with profiler.context("paintGL: %s" % self):
            self.frameSamples.append(time.time())
            if self.textureAtlas:
                self.textureAtlas.update()

            with profiler.context("renderScene"):
                rendernode.renderScene(self.renderGraph)

        self.doneCurrent()
        self.bufferSwapDone = False
        self.doSwapBuffers.emit()
Exemple #5
0
    def _loadChunk(self, cPos):

        if not self.dimension.containsChunk(*cPos):
            log.debug("Chunk %s is missing!", cPos)
            return

        if not any([client.wantsChunk(cPos) for client in self.clients]):
            log.debug("Chunk %s is unwanted.", cPos)
            return

        chunkStartTime = time.time()
        try:
            with profiler.context("getChunk"):
                chunk = self.dimension.getChunk(*cPos)
        except (EnvironmentError, LevelFormatError) as e:
            #log.exception(e)
            log.debug("Chunk %s had an error: %r!", cPos, e)
            for c in self.clients:
                if hasattr(c, 'chunkNotLoaded'):
                    c.chunkNotLoaded(cPos, e)
        else:
            for c in self.clients:
                log.debug("Chunk %s -> %s", cPos, c)
                iterator = profiler.iterate(c.recieveChunk(chunk),
                                            "Client %s" % type(c).__name__)

                if iterator:
                    for _ in iterator:
                        yield

        self.chunkSamples.append(time.time() - chunkStartTime)
        self.chunkCompleted.emit()
Exemple #6
0
    def paintGL(self):
        if not self.shouldRender:
            return
        try:
            with profiler.context("paintGL: %s" % self):
                self.frameSamples.append(time.time())
                if self.textureAtlas:
                    self.textureAtlas.update()

                with profiler.context("renderScene"):
                    rendernode.renderScene(self.renderGraph)

            if THREADED_BUFFER_SWAP:
                self.doneCurrent()
                self.bufferSwapDone = False
                self.doSwapBuffers.emit()
        except:
            self.shouldRender = False
            raise
Exemple #7
0
    def paintGL(self):
        if not self.shouldRender:
            return
        try:
            with profiler.context("paintGL: %s" % self):
                self.frameSamples.append(time.time())
                if self.textureAtlas:
                    self.textureAtlas.update()

                with profiler.context("renderScene"):
                    rendernode.renderScene(self.renderGraph)

            if THREADED_BUFFER_SWAP:
                self.doneCurrent()
                self.bufferSwapDone = False
                self.doSwapBuffers.emit()
        except:
            self.shouldRender = False
            raise
Exemple #8
0
    def __iter__(self):
        cx, cz = self.chunkUpdate.chunk.chunkPosition

        sectionBounds = SectionBox(cx, self.y, cz)
        bounds = self.chunkUpdate.chunkInfo.worldScene.bounds
        if bounds:
            sectionBounds = sectionBounds.intersect(bounds)

        modelMesh = BlockModelMesh(self)
        with profiler.context("BlockModelMesh"):
            modelMesh.createVertexArrays()
        self.blockMeshes.append(modelMesh)
        yield
Exemple #9
0
    def __iter__(self):
        cx, cz = self.chunkUpdate.chunk.chunkPosition

        sectionBounds = SectionBox(cx, self.y, cz)
        bounds = self.chunkUpdate.chunkInfo.worldScene.bounds
        if bounds:
            sectionBounds = sectionBounds.intersect(bounds)

        modelMesh = BlockModelMesh(self)
        with profiler.context("BlockModelMesh"):
            modelMesh.createVertexArrays()
        self.blockMeshes.append(modelMesh)
        yield
Exemple #10
0
    def _loadChunk(self, cPos):

        if not self.dimension.containsChunk(*cPos):
            for ref in self.clients:
                client = ref()
                if client is None:
                    continue
                if hasattr(client, 'chunkNotPresent'):
                    client.chunkNotPresent(cPos)
            return

        if not any([ref().wantsChunk(cPos)
                    for ref in self.clients
                    if ref() is not None]):
            log.debug("Chunk %s is unwanted.", cPos)
            return

        chunkStartTime = time.time()
        try:
            with profiler.context("getChunk"):
                chunk = self.dimension.getChunk(*cPos)
        except (EnvironmentError, LevelFormatError) as e:
            #log.exception(e)
            log.debug("Chunk %s had an error: %r!", cPos, e)
            for ref in self.clients:
                client = ref()
                if client is None:
                    continue
                if hasattr(client, 'chunkNotLoaded'):
                    client.chunkNotLoaded(cPos, e)
        else:
            for ref in self.clients:
                client = ref()
                if client is None:
                    continue
                log.debug("Chunk %s -> %s", cPos, client)
                iterator = profiler.iterate(client.recieveChunk(chunk), "Client %s" % type(client).__name__)

                if iterator:
                    for _ in iterator:
                        yield

        self.chunkSamples.append(time.time() - chunkStartTime)
        self.chunkCompleted.emit()
Exemple #11
0
    def paintGL(self):
        with profiler.context("paintGL: %s" % self):
            self.frameSamples.append(time.time())

            with profiler.context("renderScene"):
                rendergraph.renderScene(self.renderGraph)