Beispiel #1
0
    def update(self):
        if self.memUsageText:

            memstr = str(
                round(MemoryMonitor.getEstimatedMemUsage() / 1024.0 / 1024.0,
                      2))

            numTextureBytes = 0
            renderTextures = Globals.render.findAllTextures()
            for tex in renderTextures:
                numTextureBytes += MemoryMonitor._calculateTexSize(tex)

            texstr = str(round(numTextureBytes / 1024.0 / 1024.0, 2))

            otherTextures = TexturePool.findAllTextures()
            numOtherBytes = 0
            for tex in otherTextures:
                if tex not in renderTextures:
                    numOtherBytes += MemoryMonitor._calculateTexSize(tex)

            otherstr = str(round(numOtherBytes / 1024.0 / 1024.0, 2))

            self.memUsageText.setText("VRAM Usage: " + memstr +
                                      " MB / Textures: " + texstr +
                                      " MB / Other: " + otherstr + " MB")

        if self.fpsText:
            clock = Globals.clock
            self.fpsText.setText(
                "Frame time over {:3.1f}s     Avg: {:3.2f}     Max: {:3.2f}     Deviation: {:3.2f}"
                .format(clock.getAverageFrameRateInterval(),
                        1000.0 / clock.getAverageFrameRate(),
                        clock.getMaxFrameDuration() * 1000.0,
                        clock.calcFrameRateDeviation() * 1000.0))

        if self.stateText:
            self.stateText.setText(
                "{:6d} Render States, {:6d} Transform States".format(
                    RenderState.getNumStates(), TransformState.getNumStates()))

        if self.perfOverlay:
            self.perfOverlay.update()
    def update(self):
        if self.memUsageText:

            memstr = str(round(MemoryMonitor.getEstimatedMemUsage() / 1024.0 / 1024.0, 2))

            numTextureBytes = 0
            renderTextures = Globals.render.findAllTextures()
            for tex in renderTextures:
                numTextureBytes += MemoryMonitor._calculateTexSize(tex)

            texstr = str(round(numTextureBytes / 1024.0 / 1024.0, 2))

            otherTextures = TexturePool.findAllTextures()
            numOtherBytes = 0
            for tex in otherTextures:
                if tex not in renderTextures:
                    numOtherBytes += MemoryMonitor._calculateTexSize(tex)
            
            otherstr = str(round(numOtherBytes / 1024.0 / 1024.0, 2))

            self.memUsageText.setText("VRAM Usage: " + memstr + " MB / Textures: " + texstr + " MB / Other: " + otherstr + " MB")

        if self.fpsText:
            clock = Globals.clock
            self.fpsText.setText("Frame time over {:3.1f}s     Avg: {:3.2f}     Max: {:3.2f}     Deviation: {:3.2f}".format(
                clock.getAverageFrameRateInterval(), 
                1000.0 / clock.getAverageFrameRate(),
                clock.getMaxFrameDuration() * 1000.0,
                clock.calcFrameRateDeviation() * 1000.0
                ))

        if self.stateText:
            self.stateText.setText("{:6d} Render States, {:6d} Transform States".format(RenderState.getNumStates(), TransformState.getNumStates()))

        if self.perfOverlay:
            self.perfOverlay.update()