direct.showbase.BufferViewer

from direct.showbase.BufferViewer import BufferViewer

Contains the BufferViewer class, which is used as a debugging aid when debugging render-to-texture effects. It shows different views at the bottom of the screen showing the various render targets.

When using ShowBase, the normal way to enable the BufferViewer is using the following code:

base.bufferViewer.toggleEnable()

Or, you can enable the following variable in your Config.prc:

show-buffers true

Inheritance diagram

Inheritance diagram of direct.showbase.BufferViewer

class BufferViewer(win, parent)[source]

Bases: direct.showbase.DirectObject.DirectObject

__init__(self, win, parent)[source]

Access: private. Constructor.

advanceCard(self)[source]

Only useful when using setLayout(‘cycle’). Increments the index that selects which card to display. The index is taken modulo the actual number of cards.

analyzeTextureSet(self, x, set)[source]

Access: private. Converts a list of GraphicsObject, GraphicsEngine, and Texture into a table of Textures.

enable(self, x)[source]

Turn the buffer viewer on or off. The initial state of the buffer viewer depends on the Config variable ‘show-buffers’.

isEnabled(self)[source]

Returns true if the buffer viewer is currently enabled.

isValidTextureSet(self, x)[source]

Access: private. Returns true if the parameter is a list of GraphicsOutput and Texture, or the keyword ‘all’.

maintainReadout(self, task)[source]

Access: private. Whenever necessary, rebuilds the entire display from scratch. This is only done when the configuration parameters have changed.

makeFrame(self, sizex, sizey)[source]

Access: private. Each texture card is displayed with a two-pixel wide frame (a ring of black and a ring of white). This routine builds the frame geometry. It is necessary to be precise so that the frame exactly aligns to pixel boundaries, and so that it doesn’t overlap the card at all.

notify = <direct.directnotify.Notifier.Notifier object>
refreshReadout(self)[source]

Force the readout to be refreshed. This is usually invoked by GraphicsOutput::add_render_texture (via an event handler). However, it is also possible to invoke it manually. Currently, the only time I know of that this is necessary is after a window resize (and I ought to fix that).

selectCard(self, i)[source]

Only useful when using setLayout(‘cycle’). Sets the index that selects which card to display. The index is taken modulo the actual number of cards.

setCardSize(self, x, y)[source]

Set the size of each card. The units are relative to render2d (ie, 1x1 card is not square). If one of the dimensions is zero, then the viewer will choose a value for that dimension so as to ensure that the aspect ratio of the card matches the aspect ratio of the source-window. If both dimensions are zero, the viewer uses a heuristic to choose a reasonable size for the card. The initial value is (0, 0).

setExclude(self, x)[source]

Set the exclude-set for the buffer viewer. The exclude-set should be a list of GraphicsOutputs and Textures to ignore. The exclude-set is subtracted from the include-set (so the excludes effectively override the includes.) The initial value is the empty list.

setInclude(self, x)[source]

Set the include-set for the buffer viewer. The include-set specifies which of the render-to-texture targets to display. Valid inputs are the string ‘all’ (display every render-to-texture target), or a list of GraphicsOutputs or Textures. The initial value is ‘all’.

setLayout(self, lay)[source]

Set the layout of the cards. The valid values are:

  • vline - display them in a vertical line

  • hline - display them in a horizontal line

  • vgrid - display them in a vertical grid

  • hgrid - display them in a horizontal grid

  • cycle - display one card at a time, using selectCard/advanceCard

The default value is ‘hline’.

setPosition(self, pos)[source]

Set the position of the cards. The valid values are:

  • llcorner - put them in the lower-left corner of the window

  • lrcorner - put them in the lower-right corner of the window

  • ulcorner - put them in the upper-left corner of the window

  • urcorner - put them in the upper-right corner of the window

  • window - put them in a separate window

The initial value is ‘lrcorner’.

setRenderParent(self, renderParent)[source]

Set the scene graph root to which the output cards should be parented. The default is render2d.

setSort(self, bin, sort)[source]

Set the cull-bin and sort-order for the output cards. The default value is ‘fixed’, 10000.

toggleEnable(self)[source]

Toggle the buffer viewer on or off. The initial state of the enable flag depends on the Config variable ‘show-buffers’.