add render2d support to bufferviewer

This commit is contained in:
David Rose 2007-08-23 16:42:11 +00:00
parent dce32e24e6
commit ff73e659db
2 changed files with 10 additions and 2 deletions

View File

@ -22,6 +22,7 @@ class BufferViewer(DirectObject):
self.exclude = "none"
self.cullbin = "fixed"
self.cullsort = 10000
self.renderParent = render2d
self.cards = []
self.cardindex = 0
self.cardmaker = CardMaker("cubemaker")
@ -172,6 +173,12 @@ class BufferViewer(DirectObject):
self.cullsort = sort
self.dirty = 1
def setRenderParent(self, renderParent):
"""Set the scene graph root to which the output cards should
be parented. The default is render2d. """
self.renderParent = renderParent
self.dirty = 1
def analyzeTextureSet(self, x, set):
"""Access: private. Converts a list of GraphicsObject,
GraphicsEngine, and Texture into a table of Textures."""
@ -398,7 +405,7 @@ class BufferViewer(DirectObject):
placer.setPos(posx, 0, posy)
placer.setScale(fsizex*0.5, 1.0, fsizey*0.5)
placer.setBin(self.cullbin, self.cullsort)
placer.reparentTo(render2d)
placer.reparentTo(self.renderParent)
frame.instanceTo(placer)
cards[index].reparentTo(placer)
cards[index] = placer

View File

@ -343,6 +343,8 @@ class ShowBase(DirectObject.DirectObject):
# Offscreen buffer viewing utility.
# This needs to be allocated even if the viewer is off.
self.bufferViewer = BufferViewer()
if self.wantRender2dp:
self.bufferViewer.setRenderParent(self.render2dp)
if self.windowType != 'none':
self.__doStartDirect()
@ -923,7 +925,6 @@ class ShowBase(DirectObject.DirectObject):
self.a2dpBottomLeft.setPos(self.a2dpLeft, 0, self.a2dpBottom)
self.a2dpBottomRight.setPos(self.a2dpRight, 0, self.a2dpBottom)
def getAspectRatio(self, win = None):
# Returns the actual aspect ratio of the indicated (or main
# window), or the default aspect ratio if there is not yet a