當前位置: 首頁>>代碼示例>>Python>>正文


Python RenderingPipeline.prepareTransparentObject方法代碼示例

本文整理匯總了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)
開發者ID:croxis,項目名稱:RenderPipeline,代碼行數:70,代碼來源:main.py


注:本文中的Code.RenderingPipeline.RenderingPipeline.prepareTransparentObject方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。