def reloadTextures(textureName=''): vfs = VirtualFileSystem.getGlobalPtr() for file in glob.glob('resources/non-mf/phase_*/'): mount_point = '/' + str(os.path.split(file[:-1])[1]) vfs.mount(Filename(file), Filename(mount_point), 0) if textureName: pool = TexturePool.findAllTextures('*' + textureName + '*') else: pool = TexturePool.findAllTextures() for texture in pool: texture.reload() if textureName: return "Reloaded all textures matching '%s'" % textureName return 'Reloaded all of the textures!'
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()
def reloadTextures(self): pool = TexturePool.findAllTextures() for texture in pool: print("Reloading " + str(texture)) texture.reload()