Panda3D

Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Static Public Attributes | List of all members
TexMemWatcher Class Reference
Inheritance diagram for TexMemWatcher:

## Public Member Functions
| __init__ (self, gsg=None, limit=None)
| cleanup (self)
| enterRegion (self, region, buttonName)
| findAvailableHoles (self, area, w=None, h=None)
| findEmptyRuns (self, bm)
| findHole (self, area, w, h)
| findHolePieces (self, area)
| findLargestHole (self)
| findOverflowHole (self, area, w, h)
| formatSize (self, size)
| graphicsMemoryLimitChanged (self)
| isolateTexture (self, tr)
| leaveRegion (self, region, buttonName)
| makeCanvasBackground (self)
| mouseClick (self)
| placeTexture (self, tr)
| reconfigureWindow (self)
| repack (self)
| setLimit (self, limit=None)
| setRollover (self, tr, pi)
| setupCanvas (self)
| setupGui (self)
| unplaceTexture (self, tr)
| updateTextures (self, task)
| windowEvent (self, win)
Public Member Functions inherited from DirectObject
| __init__ (self)
| accept (self, event, method, extraArgs=[])
| acceptOnce (self, event, method, extraArgs=[])
| addTask (self, *args, **kwargs)
| detectLeaks (self)
| doMethodLater (self, *args, **kwargs)
| getAllAccepting (self)
| ignore (self, event)
| ignoreAll (self)
| isAccepting (self, event)
| isIgnoring (self, event)
| removeAllTasks (self)
| removeTask (self, taskOrName)

## Public Attributes
int | area = self.w * self.h
| aspect2d = self.render2d.attachNewNode('aspect2d')
| background = None
list | bitmasks = []
| canvas = self.canvasRoot.attachNewNode('canvas')
| canvasBackground = None
| canvasDR = self.win.makeDisplayRegion()
| canvasLens = OrthographicLens()
| canvasRoot = NodePath('canvasRoot')
| checkTex = Texture('checkTex')
bool | cleanedUp = False
bool | dynamicLimit = False
| enterRegion = '%s-enter' % (self.name)
| graphicsMemoryLimitChanged
| gsg = gsg
int | h = 1
| isolate = None
| isolated = None
| leaveRegion = '%s-leave' % (self.name)
| lens = OrthographicLens()
| limit = limit
bool | lruLimit = False
| maxHeight = base.config.GetInt('tex-mem-max-height', 300)
| mouse = base.dataRoot.attachNewNode(MouseAndKeyboard(self.win, 0, '%s-mouse' % (self.name)))
| mouseClick
| mw = MouseWatcher('%s-watcher' % (self.name))
str | name = 'tex-mem%s' % (TexMemWatcher.NextIndex)
bool | needsRepack = False
int | nextTexRecordKey = 0
| pipe = None
int | placedQSize = 0
int | placedSize = 0
int | quantize = 1
| render2d = NodePath('render2d')
| rollover = None
| sizeText = TextNode('sizeText')
| sizeTextNP = self.status.attachNewNode(self.sizeText)
| status = self.aspect2d.attachNewNode('status')
| statusBackground = self.render2d.attachNewNode(cm.generate(), -1)
| statusText = TextNode('statusText')
| statusTextNP = self.status.attachNewNode(self.statusText)
| task = taskMgr.doMethodLater(updateInterval, self.updateTextures, 'TexMemWatcher')
dict | texPlacements = {}
dict | texRecordsByKey = {}
dict | texRecordsByTex = {}
float | top = 1.0
int | totalSize = 0
int | w = 1
| win
| windowEvent = '%s-window' % (self.name)
tuple | winSize = (size[0], size[1])

## Static Public Attributes
int | NextIndex = 1
int | StatusHeight = 20
Static Public Attributes inherited from DirectObject
| accept_once = acceptOnce
| add_task = addTask
| detect_leaks = detectLeaks
| do_method_later = doMethodLater
| get_all_accepting = getAllAccepting
| ignore_all = ignoreAll
| is_accepting = isAccepting
| is_ignoring = isIgnoring
| remove_all_tasks = removeAllTasks
| remove_task = removeTask

## Additional Inherited Members
Protected Member Functions inherited from DirectObject
| _addTask (self, task)
| _clearTask (self, task)
Protected Attributes inherited from DirectObject
dict | _taskList = {}

## Detailed Description

    This class creates a separate graphics window that displays an
    approximation of the current texture memory, showing the textures
    that are resident and/or active, and an approximation of the
    amount of texture memory consumed by each one.  It's intended as a
    useful tool to help determine where texture memory is being spent.

    Although it represents the textures visually in a 2-d space, it
    doesn't actually have any idea how textures are physically laid
    out in memory--but it has to lay them out somehow, so it makes
    something up.  It occasionally rearranges the texture display when
    it feels it needs to, without regard to what the graphics card is
    actually doing.  This tool can't be used to research texture
    memory fragmentation issues.

## Constructor & Destructor Documentation

## ◆ __init__()

__init__ | ( |  | self,
|  |  | gsg = None,
|  |  | limit = None )

## Member Function Documentation

## ◆ cleanup()

cleanup | ( |  | self | ) |

## ◆ enterRegion()

enterRegion | ( |  | self,
|  |  | region,
|  |  | buttonName )

     the mouse has rolled over a texture.

## ◆ findAvailableHoles()

findAvailableHoles | ( |  | self,
|  |  | area,
|  |  | w = None,
|  |  | h = None )

     Finds a list of available holes, of at least the indicated
    area.  Returns a list of tuples, where each tuple is of the
    form (area, tp).

    If w and h are non-None, this will short-circuit on the first
    hole it finds that fits w x h, and return just that hole in a
    singleton list.

## ◆ findEmptyRuns()

findEmptyRuns | ( |  | self,
|  |  | bm )

     Separates a bitmask into a list of (l, r) tuples,
    corresponding to the empty regions in the row between 0 and
    self.w.

## ◆ findHole()

findHole | ( |  | self,
|  |  | area,
|  |  | w,
|  |  | h )

     Searches for a rectangular hole that is at least area
    square units big, regardless of its shape, but attempt to find
    one that comes close to the right shape, at least.  If one is
    found, returns an appropriate TexPlacement; otherwise, returns
    None.

## ◆ findHolePieces()

findHolePieces | ( |  | self,
|  |  | area )

     Returns a list of holes whose net area sums to the given
    area, or None if there are not enough holes.

## ◆ findLargestHole()

findLargestHole | ( |  | self | ) |

## ◆ findOverflowHole()

findOverflowHole | ( |  | self,
|  |  | area,
|  |  | w,
|  |  | h )

     Searches for a hole large enough for (w, h), in the
    overflow space.  Since the overflow space is infinite, this
    will always succeed.

## ◆ formatSize()

formatSize | ( |  | self,
|  |  | size )

     Returns a size in MB, KB, GB, whatever.

## ◆ graphicsMemoryLimitChanged()

graphicsMemoryLimitChanged | ( |  | self | ) |

## ◆ isolateTexture()

isolateTexture | ( |  | self,
|  |  | tr )

     Isolates the indicated texture onscreen, or None to
    restore normal mode.

## ◆ leaveRegion()

leaveRegion | ( |  | self,
|  |  | region,
|  |  | buttonName )

     the mouse is no longer over a texture.

## ◆ makeCanvasBackground()

makeCanvasBackground | ( |  | self | ) |

## ◆ mouseClick()

mouseClick | ( |  | self | ) |

     Received a mouse-click within the window.  This isolates
    the currently-highlighted texture into a full-window
    presentation.

## ◆ placeTexture()

placeTexture | ( |  | self,
|  |  | tr )

     Places the texture somewhere on the canvas where it will
    fit.

## ◆ reconfigureWindow()

reconfigureWindow | ( |  | self | ) |

     Resets everything for a new window size.

## ◆ repack()

repack | ( |  | self | ) |

     Repacks all of the current textures.

## ◆ setLimit()

setLimit | ( |  | self,
|  |  | limit = None )

     Indicates the texture memory limit.  If limit is None or
    unspecified, the limit is taken from the GSG, if any; or there
    is no limit.

## ◆ setRollover()

setRollover | ( |  | self,
|  |  | tr,
|  |  | pi )

     Sets the highlighted texture (due to mouse rollover) to
    the indicated texture, or None to clear it.

## ◆ setupCanvas()

setupCanvas | ( |  | self | ) |

     Creates the "canvas", which is the checkerboard area where
    texture memory is laid out.  The canvas has its own
    DisplayRegion.

## ◆ setupGui()

setupGui | ( |  | self | ) |

     Creates the gui elements and supporting structures.

## ◆ unplaceTexture()

unplaceTexture | ( |  | self,
|  |  | tr )

     Removes the texture from its place on the canvas.

## ◆ updateTextures()

updateTextures | ( |  | self,
|  |  | task )

     Gets the current list of resident textures and adds new
    textures or removes old ones from the onscreen display, as
    necessary.

## ◆ windowEvent()

windowEvent | ( |  | self,
|  |  | win )

## Member Data Documentation

## ◆ area

int area = self.w * self.h

## ◆ aspect2d

aspect2d = self.render2d.attachNewNode('aspect2d')

## ◆ background

background = None

## ◆ bitmasks

bitmasks = []

## ◆ canvas

canvas = self.canvasRoot.attachNewNode('canvas')

## ◆ canvasBackground

canvasBackground = None

## ◆ canvasDR

canvasDR = self.win.makeDisplayRegion()

## ◆ canvasLens

canvasLens = OrthographicLens()

## ◆ canvasRoot

canvasRoot = NodePath('canvasRoot')

## ◆ checkTex

checkTex = Texture('checkTex')

## ◆ cleanedUp

bool cleanedUp = False

## ◆ dynamicLimit

bool dynamicLimit = False

## ◆ enterRegion

enterRegion = '%s-enter' % (self.name)

## ◆ graphicsMemoryLimitChanged

graphicsMemoryLimitChanged

## ◆ gsg

gsg = gsg

## ◆ h

h = 1

## ◆ isolate

isolate = None

## ◆ isolated

isolated = None

## ◆ leaveRegion

leaveRegion = '%s-leave' % (self.name)

## ◆ lens

lens = OrthographicLens()

## ◆ limit

limit = limit

## ◆ lruLimit

bool lruLimit = False

## ◆ maxHeight

maxHeight = base.config.GetInt('tex-mem-max-height', 300)

## ◆ mouse

mouse = base.dataRoot.attachNewNode(MouseAndKeyboard(self.win, 0, '%s-mouse' % (self.name)))

## ◆ mouseClick

mouseClick

## ◆ mw

mw = MouseWatcher('%s-watcher' % (self.name))

## ◆ name

name = 'tex-mem%s' % (TexMemWatcher.NextIndex)

## ◆ needsRepack

bool needsRepack = False

## ◆ NextIndex

int NextIndex = 1
| static

## ◆ nextTexRecordKey

int nextTexRecordKey = 0

## ◆ pipe

pipe = None

## ◆ placedQSize

int placedQSize = 0

## ◆ placedSize

int placedSize = 0

## ◆ quantize

int quantize = 1

## ◆ render2d

render2d = NodePath('render2d')

## ◆ rollover

rollover = None

## ◆ sizeText

sizeText = TextNode('sizeText')

## ◆ sizeTextNP

sizeTextNP = self.status.attachNewNode(self.sizeText)

## ◆ status

status = self.aspect2d.attachNewNode('status')

## ◆ statusBackground

statusBackground = self.render2d.attachNewNode(cm.generate(), -1)

## ◆ StatusHeight

int StatusHeight = 20
| static

## ◆ statusText

statusText = TextNode('statusText')

## ◆ statusTextNP

statusTextNP = self.status.attachNewNode(self.statusText)

## ◆ task

task = taskMgr.doMethodLater(updateInterval, self.updateTextures, 'TexMemWatcher')

## ◆ texPlacements

dict texPlacements = {}

## ◆ texRecordsByKey

dict texRecordsByKey = {}

## ◆ texRecordsByTex

dict texRecordsByTex = {}

## ◆ top

top = 1.0

## ◆ totalSize

totalSize = 0

## ◆ w

int w = 1

## ◆ win

win

Initial value:
= base.graphicsEngine.makeOutput(self.pipe, name, 0, fbprops,
props, flags)

## ◆ windowEvent

windowEvent = '%s-window' % (self.name)

## ◆ winSize

winSize = (size[0], size[1])