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


Python Transform.tex_coords方法代碼示例

本文整理匯總了Python中Transform.tex_coords方法的典型用法代碼示例。如果您正苦於以下問題:Python Transform.tex_coords方法的具體用法?Python Transform.tex_coords怎麽用?Python Transform.tex_coords使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Transform的用法示例。


在下文中一共展示了Transform.tex_coords方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: loadMaterials

# 需要導入模塊: import Transform [as 別名]
# 或者: from Transform import tex_coords [as 別名]
    def loadMaterials(self):
        """ This method crawles the ressources for diffrent materials
            and loads them for future use
        """
        self.log.debug('loading materials from %s' % (self._materialPath, ))

        textureFactory = TF.TextureFactory.Instance()

        for file in os.listdir(self._materialPath):
            absPath = os.path.join(self._materialPath, file)

            """ if found new material, load metadata and textures """
            if os.path.isdir(absPath):
                self.log.debug('material found: %s' % (file, ))

                # load json material definition
                try:
                    defFile = open(os.path.join(absPath, "material.json"), 'r')
                    definition = "".join(defFile.readlines())
                    jsonObj = json.loads(definition)
                except Exception, e:
                    self.log.error("Error loading material metadata %s: %s" %
                            (file, str(e)))

                # create new Material object
                self._materials[jsonObj['name']] = Material()

                # load texture
                try:
                    self._materials[jsonObj['name']].name = jsonObj['name']
                    self._materials[jsonObj['name']].sustain = int(jsonObj['sustain'])
                    self._materials[jsonObj['name']].clipping = bool(jsonObj['clipping'])
                    self._materials[jsonObj['name']].transparent = bool(jsonObj['transparent'])
                    self._materials[jsonObj['name']].texture['top'] = Transform.tex_coords(
                        tuple(jsonObj['texture']['mapping']['top']['top']),
                        tuple(jsonObj['texture']['mapping']['top']['bottom']),
                        tuple(jsonObj['texture']['mapping']['top']['sides']))
                    self._materials[jsonObj['name']].texture['middle'] = Transform.tex_coords(
                        tuple(jsonObj['texture']['mapping']['middle']['top']),
                        tuple(jsonObj['texture']['mapping']['middle']['bottom']),
                        tuple(jsonObj['texture']['mapping']['middle']['sides']))
                    # A TextureGroup manages an OpenGL texture.
                    self._materials[jsonObj['name']].textureGroup = textureFactory.loadTexture(
                        os.path.join(absPath,jsonObj['texture']['ressource']))

                except Exception, e:
                    self.log.debug("Error loading material textures: %s" % (str(e), ))
開發者ID:gentoomaniac,項目名稱:Minecraft,代碼行數:49,代碼來源:Materials.py


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