本文整理汇总了Python中pandac.PandaModules.Texture.setTexturesPower2方法的典型用法代码示例。如果您正苦于以下问题:Python Texture.setTexturesPower2方法的具体用法?Python Texture.setTexturesPower2怎么用?Python Texture.setTexturesPower2使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pandac.PandaModules.Texture
的用法示例。
在下文中一共展示了Texture.setTexturesPower2方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: loadFlatQuad
# 需要导入模块: from pandac.PandaModules import Texture [as 别名]
# 或者: from pandac.PandaModules.Texture import setTexturesPower2 [as 别名]
def loadFlatQuad(self, fullFilename):
cm = CardMaker("cm-%s" % fullFilename)
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()
quad = NodePath(card)
jpgFile = PNMImage(WEB_WIDTH, WEB_HEIGHT)
smallerJpgFile = PNMImage()
readFile = smallerJpgFile.read(Filename(fullFilename))
if readFile:
jpgFile.copySubImage(smallerJpgFile, 0, 0)
guiTex = Texture("guiTex")
guiTex.setupTexture(Texture.TT2dTexture, WEB_WIDTH, WEB_HEIGHT, 1, Texture.TUnsignedByte, Texture.FRgba)
guiTex.setMinfilter(Texture.FTLinear)
guiTex.load(jpgFile)
guiTex.setWrapU(Texture.WMClamp)
guiTex.setWrapV(Texture.WMClamp)
ts = TextureStage("webTS")
quad.setTexture(ts, guiTex)
quad.setTransparency(0)
quad.setTwoSided(True)
quad.setColor(1.0, 1.0, 1.0, 1.0)
result = quad
else:
result = None
Texture.setTexturesPower2(1)
return result
示例2: update
# 需要导入模块: from pandac.PandaModules import Texture [as 别名]
# 或者: from pandac.PandaModules.Texture import setTexturesPower2 [as 别名]
def update(self, task):
if base.mouseWatcherNode.hasMouse():
(x, y) = self._translateRelativeCoordinates(
base.mouseWatcherNode.getMouseX(), base.mouseWatcherNode.getMouseY()
)
if self.mx - x != 0 or self.my - y != 0:
self.webView.injectMouseMove(x, y)
self.mx = x
self.my = y
if self.webView.isDirty():
self.webView.render(self.imgBuffer.buffer_info()[0], WEB_WIDTH * 4, 4)
Texture.setTexturesPower2(2)
textureBuffer = self.guiTex.modifyRamImage()
textureBuffer.setData(self.imgBuffer.tostring())
if self.useHalfTexture:
self.guiTex.store(self.fullPnmImage)
self.leftPnmImage.copySubImage(self.fullPnmImage, 0, 0, 0, 0, WEB_HALF_WIDTH, WEB_HEIGHT)
self.rightPnmImage.copySubImage(
self.fullPnmImage, 0, 0, WEB_HALF_WIDTH, 0, WEB_HALF_WIDTH, WEB_HEIGHT
)
self.leftGuiTex.load(self.leftPnmImage)
self.rightGuiTex.load(self.rightPnmImage)
self.quad.hide()
Texture.setTexturesPower2(1)
GlobalWebcore.update()
return Task.cont