def __init__(self, x, y): self.pos = math3d.vec2(x, y) if StarBackground.vbuff == None: StarBackground.vbuff = array.array("f") StarBackground.tbuff = array.array("f") Shapes.createRandPoints(StarBackground.vbuff, globs.numStars) Shapes.createSquareTextureArray(self.tbuff) StarBackground.vao = glCommands.setup(StarBackground.vbuff, StarBackground.tbuff) StarBackground.tex = ImageTexture2DArray(*globs.starTextures) StarBackground.prog = Program("vs.txt", "fs.txt")
def __init__(self, startPos): self.life = globs.particleLife self.currentTime = 0 self.startTime = 0 self.worldMatrix = translation2(startPos) if ParticleSystem.vao == None: vbuff = array.array("f") tbuff = array.array("f") Shapes.createRandPoints(vbuff, globs.particleCount) #Create randomVelocities tbuff = Shapes.createSquareTextureArray(tbuff) ParticleSystem.vao = glCommands.setup(vbuff, tbuff) ParticleSystem.vSize = len(vbuff) ParticleSystem.tex = ImageTexture2DArray(globs.starTextures[0]) ParticleSystem.prog = Program("particleVS.txt", "particleFS.txt")