本文整理汇总了Python中pandac.PandaModules.Texture.makeRamImage方法的典型用法代码示例。如果您正苦于以下问题:Python Texture.makeRamImage方法的具体用法?Python Texture.makeRamImage怎么用?Python Texture.makeRamImage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pandac.PandaModules.Texture
的用法示例。
在下文中一共展示了Texture.makeRamImage方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: HtmlView
# 需要导入模块: from pandac.PandaModules import Texture [as 别名]
# 或者: from pandac.PandaModules.Texture import makeRamImage [as 别名]
class HtmlView(DirectObject):
notify = DirectNotifyGlobal.directNotify.newCategory('HtmlView')
useHalfTexture = config.GetBool('news-half-texture', 0)
def __init__(self, parent = aspect2d):
global GlobalWebcore
self.parent = parent
self.mx = 0
self.my = 0
self.htmlFile = 'index.html'
self.transparency = False
if GlobalWebcore:
pass
else:
GlobalWebcore = AwWebCore(AwWebCore.LOGVERBOSE, True, AwWebCore.PFBGRA)
GlobalWebcore.setBaseDirectory('.')
for errResponse in xrange(400, 600):
GlobalWebcore.setCustomResponsePage(errResponse, 'error.html')
self.webView = GlobalWebcore.createWebView(WEB_WIDTH, WEB_HEIGHT, self.transparency, False, 70)
frameName = ''
inGameNewsUrl = self.getInGameNewsUrl()
self.imgBuffer = array.array('B')
for i in xrange(WEB_WIDTH * WEB_HEIGHT):
self.imgBuffer.append(0)
self.imgBuffer.append(0)
self.imgBuffer.append(0)
self.imgBuffer.append(255)
if self.useHalfTexture:
self.leftBuffer = array.array('B')
for i in xrange(WEB_HALF_WIDTH * WEB_HEIGHT):
self.leftBuffer.append(0)
self.leftBuffer.append(0)
self.leftBuffer.append(0)
self.leftBuffer.append(255)
self.rightBuffer = array.array('B')
for i in xrange(WEB_HALF_WIDTH * WEB_HEIGHT):
self.rightBuffer.append(0)
self.rightBuffer.append(0)
self.rightBuffer.append(0)
self.rightBuffer.append(255)
self.setupTexture()
if self.useHalfTexture:
self.setupHalfTextures()
self.accept('mouse1', self.mouseDown, [AwWebView.LEFTMOUSEBTN])
self.accept('mouse3', self.mouseDown, [AwWebView.RIGHTMOUSEBTN])
self.accept('mouse1-up', self.mouseUp, [AwWebView.LEFTMOUSEBTN])
self.accept('mouse3-up', self.mouseUp, [AwWebView.RIGHTMOUSEBTN])
def getInGameNewsUrl(self):
result = config.GetString('fallback-news-url', 'http://cdn.toontown.disney.go.com/toontown/en/gamenews/')
override = config.GetString('in-game-news-url', '')
if override:
self.notify.info('got an override url, using %s for in a game news' % override)
result = override
else:
try:
launcherUrl = base.launcher.getValue('GAME_IN_GAME_NEWS_URL', '')
if launcherUrl:
result = launcherUrl
self.notify.info('got GAME_IN_GAME_NEWS_URL from launcher using %s' % result)
else:
self.notify.info('blank GAME_IN_GAME_NEWS_URL from launcher, using %s' % result)
except:
self.notify.warning('got exception getting GAME_IN_GAME_NEWS_URL from launcher, using %s' % result)
return result
def setupTexture(self):
cm = CardMaker('quadMaker')
cm.setColor(1.0, 1.0, 1.0, 1.0)
aspect = base.camLens.getAspectRatio()
htmlWidth = 2.0 * aspect * WEB_WIDTH_PIXELS / float(WIN_WIDTH)
htmlHeight = 2.0 * float(WEB_HEIGHT_PIXELS) / float(WIN_HEIGHT)
cm.setFrame(-htmlWidth / 2.0, htmlWidth / 2.0, -htmlHeight / 2.0, htmlHeight / 2.0)
bottomRightX = WEB_WIDTH_PIXELS / float(WEB_WIDTH + 1)
bottomRightY = WEB_HEIGHT_PIXELS / float(WEB_HEIGHT + 1)
cm.setUvRange(Point2(0, 1 - bottomRightY), Point2(bottomRightX, 1))
card = cm.generate()
self.quad = NodePath(card)
self.quad.reparentTo(self.parent)
self.guiTex = Texture('guiTex')
self.guiTex.setupTexture(Texture.TT2dTexture, WEB_WIDTH, WEB_HEIGHT, 1, Texture.TUnsignedByte, Texture.FRgba)
self.guiTex.setMinfilter(Texture.FTLinear)
self.guiTex.setKeepRamImage(True)
self.guiTex.makeRamImage()
self.guiTex.setWrapU(Texture.WMRepeat)
self.guiTex.setWrapV(Texture.WMRepeat)
ts = TextureStage('webTS')
self.quad.setTexture(ts, self.guiTex)
self.quad.setTexScale(ts, 1.0, -1.0)
self.quad.setTransparency(0)
self.quad.setTwoSided(True)
self.quad.setColor(1.0, 1.0, 1.0, 1.0)
self.calcMouseLimits()
def setupHalfTextures(self):
#.........这里部分代码省略.........