add temporary tests for old pandas

This commit is contained in:
David Rose 2004-12-06 20:11:14 +00:00
parent fa592c1040
commit aa2d8d61a1

View File

@ -595,9 +595,17 @@ class ShowBase(DirectObject.DirectObject):
if flag:
if not self.frameRateMeter:
self.frameRateMeter = FrameRateMeter('frameRateMeter')
# Temporary try..except for old pandas.
try:
self.frameRateMeter.setupLayer(self.win)
except:
self.frameRateMeter.setupWindow(self.win)
else:
if self.frameRateMeter:
# Temporary try..except for old pandas.
try:
self.frameRateMeter.clearLayer()
except:
self.frameRateMeter.clearWindow()
self.frameRateMeter = None
@ -645,7 +653,7 @@ class ShowBase(DirectObject.DirectObject):
self.render2d.setMaterialOff(1)
self.render2d.setTwoSided(1)
# The normal 2-d DisplayRegoin has an aspect ratio that
# The normal 2-d DisplayRegion has an aspect ratio that
# matches the window, but its coordinate system is square.
# This means anything we parent to render2d gets stretched.
# For things where that makes a difference, we set up
@ -735,20 +743,23 @@ class ShowBase(DirectObject.DirectObject):
return aspectRatio
def makeCamera(self, win, sort = 0, scene = None,
displayRegion = (0, 1, 0, 1), aspectRatio = None,
camName = 'cam'):
displayRegion = (0, 1, 0, 1), aspectRatio = None, camName = 'cam'):
"""
Makes a new 3-d camera associated with the indicated window,
and creates a display region in the indicated subrectangle.
"""
if scene == None:
scene = self.render
# Make a display region on this window of the requested
# area.
# Temporary test for old pandas.
if hasattr(win, "getChannel"):
chan = win.getChannel(0)
layer = chan.makeLayer(sort)
dr = layer.makeDisplayRegion(*displayRegion)
else:
dr = win.makeDisplayRegion(*displayRegion)
dr.setSort(sort)
if scene == None:
scene = self.render
# By default, we do not clear 3-d display regions (the entire
# window will be cleared, which is normally sufficient).
@ -787,8 +798,12 @@ class ShowBase(DirectObject.DirectObject):
Makes a new camera2d associated with the indicated window, and
assigns it to render the indicated subrectangle of render2d.
"""
# Make a display region on this window of the requested
# area.
# Temporary test for old pandas.
if hasattr(win, "getChannel"):
chan = win.getChannel(0)
layer = chan.makeLayer(sort)
dr = layer.makeDisplayRegion(*displayRegion)
else:
dr = win.makeDisplayRegion(*displayRegion)
dr.setSort(sort)
@ -823,8 +838,12 @@ class ShowBase(DirectObject.DirectObject):
Makes a new camera2dp associated with the indicated window, and
assigns it to render the indicated subrectangle of render2dp.
"""
# Make a display region on this window of the requested
# area.
# Temporary test for old pandas.
if hasattr(win, "getChannel"):
chan = win.getChannel(0)
layer = chan.makeLayer(sort)
dr = layer.makeDisplayRegion(*displayRegion)
else:
dr = win.makeDisplayRegion(*displayRegion)
dr.setSort(sort)