当前位置: 首页>>代码示例>>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;未经允许,请勿转载。