本文整理汇总了Python中Code.RenderingPipeline.RenderingPipeline.prepareTransparentObject方法的典型用法代码示例。如果您正苦于以下问题:Python RenderingPipeline.prepareTransparentObject方法的具体用法?Python RenderingPipeline.prepareTransparentObject怎么用?Python RenderingPipeline.prepareTransparentObject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Code.RenderingPipeline.RenderingPipeline
的用法示例。
在下文中一共展示了RenderingPipeline.prepareTransparentObject方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Main
# 需要导入模块: from Code.RenderingPipeline import RenderingPipeline [as 别名]
# 或者: from Code.RenderingPipeline.RenderingPipeline import prepareTransparentObject [as 别名]
#.........这里部分代码省略.........
# Load surround scene
if self.sceneSourceSurround is not None:
self.debug("Loading Surround-Scene '" + self.sceneSourceSurround + "'")
self.sceneSurround = self.loader.loadModel(self.sceneSourceSurround)
self.sceneSurround.reparentTo(self.scene)
seed(1)
# Performance testing
if True:
highPolyObj = self.scene.find("**/HighPolyObj")
if highPolyObj is not None and not highPolyObj.isEmpty():
highPolyObj.detachNode()
self.loadingScreen.setStatus("Preparing Performance Test")
for x in xrange(-10, 10):
for y in xrange(-10, 10):
copiedObj = copy.deepcopy(highPolyObj)
# copiedObj.setColorScale(random(), random(), random(), 1)
if random() < 0.2:
copiedObj.setColorScale(0.4, 1.2, 2.0, 1.0)
copiedObj.reparentTo(self.scene)
copiedObj.setPos(x*1.5 + random(), y*1.5 + random(), random()*5.0 + 0.4)
# Find transparent objects and mark them as transparent
self.transpObjRoot = render.attachNewNode("transparentObjects")
matches = self.scene.findAllMatches("**/T__*")
if matches:
for match in matches:
# match.reparentTo(self.transpObjRoot)
self.transparentObjects.append(match)
self.renderPipeline.prepareTransparentObject(match)
# match.listTags()
match.setAttrib(CullFaceAttrib.make(CullFaceAttrib.M_none))
# match.setColorScale(1,0,1, 1)
# match.hide(self.renderPipeline.getShadowPassBitmask())
# Wheter to use a ground plane
self.usePlane = False
self.sceneWireframe = False
# Flatten scene?
self.loadingScreen.setStatus("Optimizing Scene")
# self.scene.clearModelNodes()
loader.asyncFlattenStrong(self.scene, inPlace=False, callback=self.onScenePrepared)
# self.onScenePrepared()
def onScenePrepared(self, cb=None):
""" Callback which gets called after the scene got prepared """
self.scene.reparentTo(self.render)
# Prepare textures with SRGB format
self.prepareSRGB(self.scene)
# Prepare Materials
self.renderPipeline.fillTextureStages(render)
# Load ground plane if configured
if self.usePlane:
self.groundPlane = self.loader.loadModel(
"Models/Plane/Model.egg.bam")
self.groundPlane.setPos(0, 0, -0.0001)
self.groundPlane.setScale(12.0)