shader.py 文件源码

python
阅读 35 收藏 0 点赞 0 评论 0

项目:CC3501-2017-1 作者: ppizarror 项目源码 文件源码
def __init__(self, path, tipo, compile=False, formatlist=None):
        """Constructor"""
        if tipo == FRAGMENT or tipo == VERTEX:
            self.shader = None
            self.file = str(self.load(path))
            self.tipo = tipo
            self.path = path
            self.compiled = False
            if formatlist is not None:
                if isinstance(formatlist, types.ListType):
                    num = 0
                    for f in formatlist:
                        key = '{' + str(num) + '}'
                        if key in self.file:
                            self.file = self.file.replace(key, str(f))
                        num += 1
                else:
                    raise Exception("el tipo de formatlist debe ser del tipo list")
        else:
            raise Exception("tipo de shader incorrecto, debe ser FRAGMENT o VERTEX")
        if compile:
            self.compile()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号