def __init__(self, color, color2, scaleCoords, arrayBuffer, elementBuffer, numElements, shader): Frame.__init__(self) self.color = color self.color2 = color2 self.scaleCoords = scaleCoords self.shader = shader # send data to opengl context: self.elementSize = numElements*sizeOfInt self.arrayBuffer = arrayBuffer self.elementBuffer = elementBuffer # find attribute locations: self.positionAttrib = glGetAttribLocation(shader, "position") self.normalAttrib = glGetAttribLocation(shader, "normal") self.tangentAttrib = glGetAttribLocation(shader, "tangent") self.bitangentAttrib = glGetAttribLocation(shader, "bitangent") self.uvAttrib = glGetAttribLocation(shader, "uv") # find the uniform locations: self.modelUnif = glGetUniformLocation(shader, "model") self.viewUnif = glGetUniformLocation(shader, "view") self.projectionUnif = glGetUniformLocation(shader, "projection") self.lightUnif = glGetUniformLocation(shader, "light") self.scaleCoordsUnif = glGetUniformLocation(shader, "scalecoords") self.colorUnif = glGetUniformLocation(shader, "color") self.color2Unif = glGetUniformLocation(shader, "color2")
def run(this, point, scale, shape): out = Frame() scale = scale.getNext() point = point.getNext() for value in shape.getNext().values: out.addValue((value[0] * scale + point[1], value[1] * scale + point[1], value[2] * scale + point[2])) return out
def __init__(self, colortexture, normaltexture, arrayBuffer, elementBuffer, numElements, shader): Frame.__init__(self) self.useNormals = 1 self.colorTexture = colortexture self.normalTexture = normaltexture self.shader = shader # send data to opengl context: self.elementSize = numElements*sizeOfInt self.arrayBuffer = arrayBuffer self.elementBuffer = elementBuffer # find attribute locations: self.positionAttrib = glGetAttribLocation(shader, "position") self.normalAttrib = glGetAttribLocation(shader, "normal") self.tangentAttrib = glGetAttribLocation(shader, "tangent") self.bitangentAttrib = glGetAttribLocation(shader, "bitangent") self.uvAttrib = glGetAttribLocation(shader, "uv") # find the uniform locations: self.colorSamplerUnif = glGetUniformLocation(shader, "colorsampler") self.normalSamplerUnif = glGetUniformLocation(shader, "normalsampler") self.modelUnif = glGetUniformLocation(shader, "model") self.viewUnif = glGetUniformLocation(shader, "view") self.projectionUnif = glGetUniformLocation(shader, "projection") self.lightUnif = glGetUniformLocation(shader, "light") self.useNormalsUnif = glGetUniformLocation(shader, "usenormals")
def __init__(self, colortexture, vertexArray, shader): Frame.__init__(self) self.useNormals = 1 self.colorTexture = colortexture self.shader = shader # send data to opengl context: vertices = vertexArray[0] elements = vertexArray[1] self.elementSize = len(elements)*sizeOfShort self.arrayBuffer = getBuffer(vertices, GL_ARRAY_BUFFER) self.elementBuffer = getBuffer(elements, GL_ELEMENT_ARRAY_BUFFER) # find attribute locations: self.positionAttrib = glGetAttribLocation(shader, "position") self.normalAttrib = glGetAttribLocation(shader, "normal") self.tangentAttrib = glGetAttribLocation(shader, "tangent") self.bitangentAttrib = glGetAttribLocation(shader, "bitangent") self.uvAttrib = glGetAttribLocation(shader, "uv") # find the uniform locations: self.colorSamplerUnif = glGetUniformLocation(shader, "colorsampler") self.normalSamplerUnif = glGetUniformLocation(shader, "normalsampler") self.modelUnif = glGetUniformLocation(shader, "model") self.viewUnif = glGetUniformLocation(shader, "view") self.projectionUnif = glGetUniformLocation(shader, "projection") self.lightUnif = glGetUniformLocation(shader, "light") self.useNormalsUnif = glGetUniformLocation(shader, "usenormals")
async def invite(): base_pattern = r'(https:)|(w{3}\.+)' if re.search(base_pattern + r'discord\.gg', message.content): await message.channel.send(embed=Frame().warning(message.author, 'Posted an invite')) elif re.search(r'(https:)|(w{3}\.+)', message.content): await message.channel.send(embed=Frame().warning(message.author, 'Posted a link')) await message.delete()
def __init__(self, texture, arrayBuffer, elementBuffer, numElements, shader, scaleuv= N.array((1,1),dtype=N.float32), fade = 1.0): Frame.__init__(self) self.texture = texture self.shader = shader self.scaleuv = scaleuv self.fade = fade # send data to opengl context: self.elementSize = numElements*sizeOfShort self.arrayBuffer = arrayBuffer self.elementBuffer = elementBuffer # find attribute locations: self.positionAttrib = glGetAttribLocation(shader, "position") self.uvAttrib = glGetAttribLocation(shader, "uv") # find the uniform locations: self.colorSamplerUnif = glGetUniformLocation(shader, "colorsampler") self.scaleuvUnif = glGetUniformLocation(shader, "scaleuv") self.modelUnif = glGetUniformLocation(shader, "model") self.viewUnif = glGetUniformLocation(shader, "view") self.projectionUnif = glGetUniformLocation(shader, "projection") self.fadeUnif = glGetUniformLocation(shader, "fade")
def __init__(self, textures, arrayBuffer, elementBuffer, numElements, shader, scaleuv= N.array((1,1),dtype=N.float32), fade = 1.0): Frame.__init__(self) self.textures = textures self.shader = shader self.scaleuv = scaleuv self.fade = fade # send data to opengl context: self.elementSize = numElements*sizeOfInt self.arrayBuffer = arrayBuffer self.elementBuffer = elementBuffer # find attribute locations: self.positionAttrib = glGetAttribLocation(shader, "position") self.uvAttrib = glGetAttribLocation(shader, "uv") # find the uniform locations: self.s0Unif = glGetUniformLocation(shader, "s0") self.s1Unif = glGetUniformLocation(shader, "s1") self.s2Unif = glGetUniformLocation(shader, "s2") self.s3Unif = glGetUniformLocation(shader, "s3") self.s4Unif = glGetUniformLocation(shader, "s4") self.s5Unif = glGetUniformLocation(shader, "s5") self.s6Unif = glGetUniformLocation(shader, "s6") self.s7Unif = glGetUniformLocation(shader, "s7") self.scaleuvUnif = glGetUniformLocation(shader, "scaleuv") self.modelUnif = glGetUniformLocation(shader, "model") self.viewUnif = glGetUniformLocation(shader, "view") self.projectionUnif = glGetUniformLocation(shader, "projection")
def run(this): out = Frame() out.addValue((0.5, 0.5, 0)) out.addValue((-0.5, 0.5, 0)) out.addValue((-0.5, -0.5, 0)) out.addValue((0.5, -0.5, 0)) return out
def playFrames(): base = [ Frame([[0,0,0], [0,0,0], [0,0,0]], 1), Frame([[0,0,0], [1,0,0], [0,0,0]], 2), Frame([[0,0,0], [1,1,0], [0,0,0]], 1), Frame([[0,0,0], [1,1,1], [0,0,0]], 1) ] reversed = base[:] reversed.reverse() player.play(base + reversed + base + reversed) return 'playing'
def run(this, widthIn, heightIn): out = Frame() width = widthIn.getNext() height = heightIn.getNext() out.addValue((width/2.0, height/2.0, 0)) out.addValue((width/2.0, -height/2.0, 0)) out.addValue((-width/2.0, -height/2.0, 0)) out.addValue((-width/2.0, height/2.0, 0)) return out
async def user_info(self, ctx, member: discord.Member = None): """ Shows info about user, e.g {command_prefix}user_info @testuser. If member argument is not passed show info about user invoking the command """ member = ctx.author if not member else member await ctx.send(embed=Frame().user_info(ctx, member))
def __init__(self, posxTexture, negxTexture, posyTexture, negyTexture, poszTexture, negzTexture, vertexArray, shader): Frame.__init__(self) self.posxTexture = posxTexture self.negxTexture = negxTexture self.posyTexture = posyTexture self.negyTexture = negyTexture self.poszTexture = poszTexture self.negzTexture = negzTexture self.shader = shader # send data to opengl context: vertices = vertexArray[0] elements = vertexArray[1] self.elementSize = len(elements)*sizeOfShort self.arrayBuffer = getBuffer(vertices, GL_ARRAY_BUFFER) self.elementBuffer = getBuffer(elements, GL_ELEMENT_ARRAY_BUFFER) # find attribute locations: self.positionAttrib = glGetAttribLocation(shader, "position") self.normalAttrib = glGetAttribLocation(shader, "normal") self.tangentAttrib = glGetAttribLocation(shader, "tangent") self.bitangentAttrib = glGetAttribLocation(shader, "bitangent") # find the uniform locations: self.posxUnif = glGetUniformLocation(shader, "posxsampler") self.negxUnif = glGetUniformLocation(shader, "negxsampler") self.posyUnif = glGetUniformLocation(shader, "posysampler") self.negyUnif = glGetUniformLocation(shader, "negysampler") self.poszUnif = glGetUniformLocation(shader, "poszsampler") self.negzUnif = glGetUniformLocation(shader, "negzsampler") self.modelUnif = glGetUniformLocation(shader, "model") self.viewUnif = glGetUniformLocation(shader, "view") self.projectionUnif = glGetUniformLocation(shader, "projection") self.lightUnif = glGetUniformLocation(shader, "light") self.colorUnif = glGetUniformLocation(shader, "color")
def __init__(self, posxTexture, negxTexture, posyTexture, negyTexture, poszTexture, negzTexture, arrayBuffer, elementBuffer, numElements, shader): Frame.__init__(self) self.posxTexture = posxTexture self.negxTexture = negxTexture self.posyTexture = posyTexture self.negyTexture = negyTexture self.poszTexture = poszTexture self.negzTexture = negzTexture self.shader = shader # send data to opengl context: self.elementSize = numElements*sizeOfInt self.arrayBuffer = arrayBuffer self.elementBuffer = elementBuffer # find attribute locations: self.positionAttrib = glGetAttribLocation(shader, "position") self.normalAttrib = glGetAttribLocation(shader, "normal") self.tangentAttrib = glGetAttribLocation(shader, "tangent") self.bitangentAttrib = glGetAttribLocation(shader, "bitangent") # find the uniform locations: self.posxUnif = glGetUniformLocation(shader, "posxsampler") self.negxUnif = glGetUniformLocation(shader, "negxsampler") self.posyUnif = glGetUniformLocation(shader, "posysampler") self.negyUnif = glGetUniformLocation(shader, "negysampler") self.poszUnif = glGetUniformLocation(shader, "poszsampler") self.negzUnif = glGetUniformLocation(shader, "negzsampler") self.modelUnif = glGetUniformLocation(shader, "model") self.viewUnif = glGetUniformLocation(shader, "view") self.projectionUnif = glGetUniformLocation(shader, "projection") self.lightUnif = glGetUniformLocation(shader, "light") self.colorUnif = glGetUniformLocation(shader, "color")
def __init__(self, texture, vertexArray, shader, scaleuv): Frame.__init__(self) self.texture = texture self.shader = shader self.scaleuv = scaleuv # send data to opengl context: vertices = vertexArray[0] elements = vertexArray[1] self.elementSize = len(elements)*sizeOfShort self.arrayBuffer = getBuffer(vertices, GL_ARRAY_BUFFER) self.elementBuffer = getBuffer(elements, GL_ELEMENT_ARRAY_BUFFER) # find attribute locations: self.positionAttrib = glGetAttribLocation(shader, "position") self.uvAttrib = glGetAttribLocation(shader, "uv") # find the uniform locations: self.colorSamplerUnif = glGetUniformLocation(shader, "colorsampler") self.scaleuvUnif = glGetUniformLocation(shader, "scaleuv") self.modelUnif = glGetUniformLocation(shader, "model") self.viewUnif = glGetUniformLocation(shader, "view") self.projectionUnif = glGetUniformLocation(shader, "projection")
def run(this): out = Frame() out.values = this.points return out
def run(this): out = Frame() for point in range(this.numPoints): angle = point * 2 * math.pi / this.numPoints out.addValue((math.cos(angle), math.sin(angle), 0)) return out
def displayFrame(): player.stop() player.play([Frame(loads(request.data)['frame'], PERMANENT_FRAME_INTERVAL)]) return 'ok'
# from objects import BatchedTDMIO # fname = '/home/ilya/code/frb/data/630_sec_wb_raes08a_128ch.npy' # fname = '/home/ilya/code/frb/data/crab_600sec_64ch_1ms.npy' # frame = DataFrame(fname, 1684., 0., 16. / 64., 0.001) # frame = DataFrame(fname, 1684., 0., 16. / 128., 0.001) # frame.add_pulse(100., 0.7, 0.003, 300.) # frame.add_pulse(200., 0.7, 0.001, 400.) # frame.add_pulse(300., 0.7, 0.006, 200.) # frame.add_pulse(400., 2.7, 0.002, 500.) # frame.add_pulse(500., 0.7, 0.003, 600.) # frame.add_pulse(600., 0.7, 0.004, 300.) # frame.add_pulse(300., 1.0, 0.003, dm=500.) # dm_values = frame.create_dm_grid(0., 300., 10.) # t0 = time.time() print "Creating frame" frame = Frame(512, 600000, 1684., 0., 16./512, 1./1000) print "Adding pulse" # frame.add_pulse(100., 0.09, 0.003, 100.) # frame.add_pulse(200., 0.09, 0.003, 200.) frame.add_pulse(300., 0.09, 0.003, 300.) # frame.add_pulse(400., 0.09, 0.003, 500.) # frame.add_pulse(500., 0.09, 0.003, 700.) print "Adding noise" frame.add_noise(0.5) dm_values = frame.create_dm_grid(0., 1000., 10) # t0 = time.time() # result = de_disperse(frame.values, 1684, 16./512, 0.001, dm_values) # t1 = time.time() # print "Dedispersion took", t1 - t0 t0 = time.time() result = split_de_disperse(frame.values, 1668., 1684., 0.001, dm_values, 4)