本文整理汇总了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), ))