def draw(self, pipeline, texture1, texture2, texture3): if self.jump: #cuando esta saltando self.monkey = es.toGPUShape(bs.createTextureQuad(texture2), GL_REPEAT, GL_LINEAR) glUseProgram(pipeline.shaderProgram) glUniformMatrix4fv( glGetUniformLocation(pipeline.shaderProgram, "transform"), 1, GL_TRUE, self.transmonkey) pipeline.drawShape(self.monkey) elif self.winner: self.monkey = es.toGPUShape(bs.createTextureQuad(texture3), GL_REPEAT, GL_LINEAR) glUseProgram(pipeline.shaderProgram) glUniformMatrix4fv( glGetUniformLocation(pipeline.shaderProgram, "transform"), 1, GL_TRUE, self.transmonkey) pipeline.drawShape(self.monkey) else: #cuando se encuentra en reposo self.monkey = es.toGPUShape(bs.createTextureQuad(texture1), GL_REPEAT, GL_LINEAR) glUseProgram(pipeline.shaderProgram) glUniformMatrix4fv( glGetUniformLocation(pipeline.shaderProgram, "transform"), 1, GL_TRUE, self.transmonkey) pipeline.drawShape(self.monkey)
def __init__(self, tamaño): self.tamaño = tamaño #centra la cabeza de la serpiente al comienzo if self.tamaño % 2 == 0: self.pos = [[d / self.tamaño, d / self.tamaño], [d * 3 / self.tamaño, d / self.tamaño], [d * 5 / tamaño, d / self.tamaño], [d * 7 / tamaño, d / self.tamaño]] #self.pos = [[1/self.tamaño,1/self.tamaño],[3/self.tamaño,1/self.tamaño],[5/tamaño,1/self.tamaño]] else: self.pos = [[0, 0], [d * 2 / self.tamaño, 0], [d * 4 / self.tamaño, 0], [d * 6 / self.tamaño, 0]] #self.pos = [[0,0],[2/self.tamaño,0],[4/self.tamaño,0]] #self.dir = [['left','left'],['left','left'],['left','left']] self.dir = [['left', 'left'], ['left', 'left'], ['left', 'left'], ['left', 'left']] self.die = False self.comio = False self.comio_cola = False self.comiendo = False # Figuras básicas #gpu_trozo = es.toGPUShape(bs.createColorQuad(0, 0.3, 0)) # verde gpu_trozo = es.toGPUShape(bs.createTextureQuad('cuerpo.png'), GL_REPEAT, GL_NEAREST) gpu_trozo_cabeza = es.toGPUShape(bs.createTextureQuad('cabeza.png'), GL_REPEAT, GL_NEAREST) trozo = sg.SceneGraphNode('trozo') trozo.transform = tr.uniformScale(d * 2 / self.tamaño) trozo.childs += [gpu_trozo] trozo_cabeza = sg.SceneGraphNode('trozo') trozo_cabeza.transform = tr.uniformScale(d * 2 / self.tamaño) trozo_cabeza.childs += [gpu_trozo_cabeza] cuerpo = sg.SceneGraphNode('cuerpo') cuerpo.childs += [trozo] cuerpo2 = sg.SceneGraphNode('cuerpo2') cuerpo2.childs += [trozo] cola = sg.SceneGraphNode('cola') cola.childs += [trozo] cabeza = sg.SceneGraphNode('cabeza') cabeza.childs += [trozo_cabeza] self.serpiente = [cabeza, cuerpo, cuerpo2, cola] #self.serpiente =[cabeza,cuerpo,cola] self.tiempo = 0
def draw(self, pipeline): if self.last_direction == "D": self.face_orientation = "D" new_gpu_snake = es.toGPUShape(bs.createTextureQuad("boo_r.png"), GL_CLAMP, GL_NEAREST) sg.findNode(self.model, "snake_head").childs = [new_gpu_snake] elif self.last_direction == "A": self.face_orientation = "A" new_gpu_snake = es.toGPUShape(bs.createTextureQuad("boo_l.png"), GL_CLAMP, GL_NEAREST) sg.findNode(self.model, "snake_head").childs = [new_gpu_snake] sg.drawSceneGraphNode(self.model, pipeline, "transform")
def __init__(self, texture): self.notice = es.toGPUShape(bs.createTextureQuad(texture), GL_REPEAT, GL_LINEAR) self.transnotice = np.matmul(tr2.translate(0, 0.4, 0), tr2.scale(-1, 1, 1)) self.winner = False self.loser = False
def crece(self): tamaño_snake = len(self.dir) direccion_cola = self.dir[-1][1] #self.pos += [self.pos[-1]] if direccion_cola == 'left': self.pos += [[self.pos[-1][0], self.pos[-1][1]]] elif direccion_cola == 'right': self.pos += [[self.pos[-1][0], self.pos[-1][1]]] elif direccion_cola == 'up': self.pos += [[self.pos[-1][0], self.pos[-1][1]]] else: self.pos += [[self.pos[-1][0], self.pos[-1][1]]] self.dir += [['stop', 'stop']] gpu_trozo = es.toGPUShape(bs.createTextureQuad('cuerpo.png'), GL_REPEAT, GL_NEAREST) trozo = sg.SceneGraphNode('trozo') trozo.transform = tr.uniformScale(d * 2 / self.tamaño) trozo.childs += [gpu_trozo] aum = sg.SceneGraphNode(str(tamaño_snake)) aum.childs += [trozo] self.serpiente += [aum]
def __init__(self, pos, orientation): fondo = es.toGPUShape(bs.createTextureQuad("liana.jpg", 1, 1), GL_REPEAT, GL_LINEAR) fondoTransform= tr.uniformScale(2) self.model = fondo self.tra = fondoTransform self.pos = pos self.orientation = orientation
def __init__(self, texture): self.banana = es.toGPUShape(bs.createTextureQuad(texture), GL_REPEAT, GL_LINEAR) self.pos_x = 0 #será la posición lógica donde se ubicará la banana, se indicará con posterioridad self.level = 0 #indica en que nivel partira la banana, se indicará con posterioridad self.transbanana = np.matmul( tr2.translate(0.7 * self.pos_x, 0.47 * self.level, 0), tr2.scale(0.3, 0.3, 1)) self.set = False
def __init__(self, frame_width, frame_height, tiles=50): self.tiles = min(50, max(10, tiles)) self.frame_dim = [frame_width, frame_height] self.locationX = int(self.tiles / 2) self.locationY = int(self.tiles / 2) self.last_position = [self.locationX, self.locationY] self.last_direction = "A" # "A" means "left" according to our WASD control buttons self.next_direction = "A" self.face_orientation = "A" self.life_status = True self.body_queue = [] self.movement_queue = [] self.occupied_positions = [[self.last_position]] self.recently_added_body = False self.gpu_body = es.toGPUShape(bs.createTextureQuad("question_box.png"), GL_CLAMP, GL_NEAREST) self.current_apple = None # Aspect ratio ar = frame_height / frame_width self.dimensions = [ar * 0.95 * 2 * 4 / 5, 0.95 * 2 * 4 / 5] gpu_snake = es.toGPUShape(bs.createTextureQuad("boo_l.png"), GL_CLAMP, GL_NEAREST) snake_head = sg.SceneGraphNode('snake_head') snake_head.transform = tr.matmul([ tr.scale(self.dimensions[0] / self.tiles, self.dimensions[1] / self.tiles, 0), tr.translate(-self.tiles / 2 + self.locationX + 0.5, -self.tiles / 2 + self.locationY - 0.5, 0) ]) snake_head.childs += [gpu_snake] snake = sg.SceneGraphNode('snake') snake.childs += [snake_head] snake_tr = sg.SceneGraphNode('snake_TR') snake_tr.childs += [snake] self.model = snake_tr
def draw(self, pipeline, texture1, texture2): if self.winner: #cuando esta saltando self.notice = es.toGPUShape(bs.createTextureQuad(texture1), GL_REPEAT, GL_LINEAR) glUseProgram(pipeline.shaderProgram) glUniformMatrix4fv( glGetUniformLocation(pipeline.shaderProgram, "transform"), 1, GL_TRUE, self.transnotice) pipeline.drawShape(self.notice) elif self.loser: self.notice = es.toGPUShape(bs.createTextureQuad(texture2), GL_REPEAT, GL_LINEAR) glUseProgram(pipeline.shaderProgram) glUniformMatrix4fv( glGetUniformLocation(pipeline.shaderProgram, "transform"), 1, GL_TRUE, self.transnotice) pipeline.drawShape(self.notice)
def __init__(self, texture1): self.monkey = es.toGPUShape(bs.createTextureQuad(texture1), GL_REPEAT, GL_LINEAR) self.transmonkey = np.matmul(tr2.translate(0, -0.74, 0), tr2.scale(0.4, 0.4, 1)) self.pos = 0 self.jump = False #indicará si el monito esta saltando para poder dibujarlo con otra textura self.logic = False #indica si la lógica del juego está activa o no self.winner = False #indica si el jugador ganó o no self.level = 0 #indica en que nivel con respecto al suelo se encuentra el monito self.started = False #indica que si el juego empezó o no. Empieza cuando el mono se sube a la primera plataforma.
def __init__(self, texture): self.texture = texture monop = es.toGPUShape(bs.createTextureQuad(self.texture, 1, 1), GL_REPEAT, GL_LINEAR) self.model = monop self.pos_x = 0 self.pos_y = -0.7 self.pos=-0.7 monopTransform= tr.matmul([tr.translate(self.pos_x, self.pos_y, 0), tr.uniformScale(0.5)]) self.tra = monopTransform self.winner = False #aun no gana self.loser = False #aun no pierde
def createGameOver(victory=False): image = "victory_texture.png" if victory else "game_over_texture.png" textureShape = es.toGPUShape(bs.createTextureQuad(image), GL_CLAMP_TO_EDGE, GL_LINEAR) scaledTexture = sg.SceneGraphNode("scaledTexture") scaledTexture.transform = tr.uniformScale(2) scaledTexture.childs += [textureShape] texture = sg.SceneGraphNode("texture") texture.childs += [scaledTexture] return texture
def create_gameover_screen(filename): # filename - File path of game over texture # Load background image gpuGameOver = es.toGPUShape(bs.createTextureQuad(filename), GL_REPEAT, GL_LINEAR) #Create two background copies to have a scrolling effect gameover = sg.SceneGraphNode("gameover") gameover.transform = tr.scale(2, 2, 1) gameover.childs = [gpuGameOver] # Node to control vertical movement of the two gameovers objects gameoverVertical = sg.SceneGraphNode("gameoverVertical") gameoverVertical.childs = [gameover] return gameoverVertical
def game_over(self): gpu_game_over = es.toGPUShape(bs.createTextureQuad("game_over.png"), GL_CLAMP, GL_NEAREST) game_over = sg.SceneGraphNode('game_over_banner') game_over.transform = tr.matmul( [tr.scale(2.3, 1 / 5, 0), tr.translate(0, 0, 0)]) # traslation to top was 4.5 game_over.childs += [gpu_game_over] game_over_tr = sg.SceneGraphNode('game_over_banner_TR') game_over_tr.childs += [game_over] self.g_over = game_over_tr self.alive = False
def choca_esquina(self, snake: 'Snake'): condicionx = snake.pos[0][0] > 1 - d * 2 / snake.tamaño or snake.pos[ 0][0] < -1 + d * 2 / snake.tamaño condiciony = snake.pos[0][1] > 1 - d * 2 / snake.tamaño or snake.pos[ 0][1] < -1 + d * 2 / snake.tamaño condicion_come_cola = snake.comio_cola if condicionx or condiciony or condicion_come_cola: gpu_gameover = es.toGPUShape(bs.createTextureQuad('gameover.png'), GL_REPEAT, GL_NEAREST) # azul gameover = sg.SceneGraphNode('gameover') gameover.transform = tr.uniformScale(2) gameover.childs += [gpu_gameover] self.model = gameover snake.die = True
def createEarth(): gpuEarth_texture = es.toGPUShape( bs.createTextureQuad("textures/earth.png"), GL_REPEAT, GL_NEAREST) earth_scaled = sg.SceneGraphNode("earth_scaled") earth_scaled.transform = tr2.scale(0.5, 0.5, 0.5) earth_scaled.childs += [gpuEarth_texture] earth_rotated = sg.SceneGraphNode("earth_rotated_x") earth_rotated.transform = tr2.rotationX(np.pi / 2) earth_rotated.childs += [earth_scaled] earth = sg.SceneGraphNode("earth") earth.transform = tr2.translate(0.5, 4, 0.6) earth.childs += [earth_rotated] return earth
def createGround(image, trans): gpuGround_texture = es.toGPUShape(bs.createTextureQuad(image), GL_REPEAT, GL_NEAREST) ground_scaled = sg.SceneGraphNode("ground_scaled") ground_scaled.transform = tr2.scale(2, 2, 2) ground_scaled.childs += [gpuGround_texture] ground_rotated = sg.SceneGraphNode("ground_rotated_x") ground_rotated.transform = tr2.rotationX(0) ground_rotated.childs += [ground_scaled] ground = sg.SceneGraphNode("ground") ground.transform = tr2.translate(0, 0, trans) ground.childs += [ground_rotated] return ground
def createAmbiente(filename, x, y, z, rot): gpuAirport_texture = es.toGPUShape(bs.createTextureQuad(filename), GL_REPEAT, GL_LINEAR) ambiente_scaled = sg.SceneGraphNode("ambiente_scaled") ambiente_scaled.transform = tr2.scale(2, 2, 2) ambiente_scaled.childs += [gpuAirport_texture] ambiente_rotated = sg.SceneGraphNode("ambiente_rotated") ambiente_rotated.transform = np.matmul(tr2.rotationX(np.pi / 2), tr2.rotationY(rot)) ambiente_rotated.childs += [ambiente_scaled] ambiente = sg.SceneGraphNode("ambiente") ambiente.transform = tr2.translate(x, y, z) ambiente.childs += [ambiente_rotated] return ambiente
def create_background(filename): # filename - File path of background texture # Load background image gpuStars = es.toGPUShape(bs.createTextureQuad(filename), GL_REPEAT, GL_LINEAR) #Create two background copies to have a scrolling effect background = sg.SceneGraphNode("background") background.transform = tr.scale(2, 2, 1) background.childs = [gpuStars] background2 = sg.SceneGraphNode("background2") background2.transform = tr.matmul( [tr.scale(2, 2, 1), tr.translate(0, -1, 0)]) background2.childs = [gpuStars] # Node to control vertical movement of the two backgrounds objects backgroundVertical = sg.SceneGraphNode("backgroundVertical") backgroundVertical.childs = [background, background2] return backgroundVertical
def TapaCursoNorm(codigo): #Primer año DP101 = es.toGPUShape(bs.createTextureQuad("DP_101.png"), GL_REPEAT, GL_NEAREST) DP102 = es.toGPUShape(bs.createTextureQuad("DP_102.png"), GL_REPEAT, GL_NEAREST) DP103 = es.toGPUShape(bs.createTextureQuad("DP_103.png"), GL_REPEAT, GL_NEAREST) DT104 = es.toGPUShape(bs.createTextureQuad("DT_104.png"), GL_REPEAT, GL_NEAREST) DT105 = es.toGPUShape(bs.createTextureQuad("DT_105.png"), GL_REPEAT, GL_NEAREST) DH106 = es.toGPUShape(bs.createTextureQuad("DH_106.png"), GL_REPEAT, GL_NEAREST) DH107 = es.toGPUShape(bs.createTextureQuad("DH_107.png"), GL_REPEAT, GL_NEAREST) DH108 = es.toGPUShape(bs.createTextureQuad("DH_108.png"), GL_REPEAT, GL_NEAREST) #Segundo año DGP201 = es.toGPUShape(bs.createTextureQuad("DGP_201.png"), GL_REPEAT, GL_NEAREST) DGP202 = es.toGPUShape(bs.createTextureQuad("DGP_202.png"), GL_REPEAT, GL_NEAREST) DGP203 = es.toGPUShape(bs.createTextureQuad("DGP_203.png"), GL_REPEAT, GL_NEAREST) DGT204 = es.toGPUShape(bs.createTextureQuad("DGT_204.png"), GL_REPEAT, GL_NEAREST) DGT205 = es.toGPUShape(bs.createTextureQuad("DGT_205.png"), GL_REPEAT, GL_NEAREST) DGH206 = es.toGPUShape(bs.createTextureQuad("DGH_206.png"), GL_REPEAT, GL_NEAREST) DGH207 = es.toGPUShape(bs.createTextureQuad("DGH_207.png"), GL_REPEAT, GL_NEAREST) DGH208 = es.toGPUShape(bs.createTextureQuad("DGH_208.png"), GL_REPEAT, GL_NEAREST) #Quinto Semestre DGP301 = es.toGPUShape(bs.createTextureQuad("DGP_301.png"), GL_REPEAT, GL_NEAREST) DGT302 = es.toGPUShape(bs.createTextureQuad("DGT_302.png"), GL_REPEAT, GL_NEAREST) DGT303 = es.toGPUShape(bs.createTextureQuad("DGT_303.png"), GL_REPEAT, GL_NEAREST) DGT304 = es.toGPUShape(bs.createTextureQuad("DGT_304.png"), GL_REPEAT, GL_NEAREST) DGH305 = es.toGPUShape(bs.createTextureQuad("DGH_305.png"), GL_REPEAT, GL_NEAREST) DGH306 = es.toGPUShape(bs.createTextureQuad("DGH_306.png"), GL_REPEAT, GL_NEAREST) DGH307 = es.toGPUShape(bs.createTextureQuad("DGH_307.png"), GL_REPEAT, GL_NEAREST) DE1 = es.toGPUShape(bs.createTextureQuad("DE_1.png"), GL_REPEAT, GL_NEAREST) #Sexto Semestre DGP401 = es.toGPUShape(bs.createTextureQuad("DGP_401.png"), GL_REPEAT, GL_NEAREST) DGT402 = es.toGPUShape(bs.createTextureQuad("DGT_402.png"), GL_REPEAT, GL_NEAREST) DGT403 = es.toGPUShape(bs.createTextureQuad("DGT_403.png"), GL_REPEAT, GL_NEAREST) DGT404 = es.toGPUShape(bs.createTextureQuad("DGT_404.png"), GL_REPEAT, GL_NEAREST) DGH405 = es.toGPUShape(bs.createTextureQuad("DGH_405.png"), GL_REPEAT, GL_NEAREST) DGH406 = es.toGPUShape(bs.createTextureQuad("DGH_406.png"), GL_REPEAT, GL_NEAREST) DGH407 = es.toGPUShape(bs.createTextureQuad("DGH_407.png"), GL_REPEAT, GL_NEAREST) DE2 = es.toGPUShape(bs.createTextureQuad("DE_2.png"), GL_REPEAT, GL_NEAREST) #Septimo Semestre DGP501 = es.toGPUShape(bs.createTextureQuad("DGP_501.png"), GL_REPEAT, GL_NEAREST) DGP502 = es.toGPUShape(bs.createTextureQuad("DGP_502.png"), GL_REPEAT, GL_NEAREST) DGT503 = es.toGPUShape(bs.createTextureQuad("DGT_503.png"), GL_REPEAT, GL_NEAREST) DGH504 = es.toGPUShape(bs.createTextureQuad("DGH_504.png"), GL_REPEAT, GL_NEAREST) DGH505 = es.toGPUShape(bs.createTextureQuad("DGH_505.png"), GL_REPEAT, GL_NEAREST) DGH506 = es.toGPUShape(bs.createTextureQuad("DGH_506.png"), GL_REPEAT, GL_NEAREST) DGH507 = es.toGPUShape(bs.createTextureQuad("DGH_507.png"), GL_REPEAT, GL_NEAREST) DE3 = es.toGPUShape(bs.createTextureQuad("DE_2.png"), GL_REPEAT, GL_NEAREST) #Octavo Semestre DGP601 = es.toGPUShape(bs.createTextureQuad("DGP_601.png"), GL_REPEAT, GL_NEAREST) DGP602 = es.toGPUShape(bs.createTextureQuad("DGP_602.png"), GL_REPEAT, GL_NEAREST) DGT603 = es.toGPUShape(bs.createTextureQuad("DGT_603.png"), GL_REPEAT, GL_NEAREST) DGH604 = es.toGPUShape(bs.createTextureQuad("DGH_604.png"), GL_REPEAT, GL_NEAREST) DGH605 = es.toGPUShape(bs.createTextureQuad("DGH_605.png"), GL_REPEAT, GL_NEAREST) DGH606 = es.toGPUShape(bs.createTextureQuad("DGH_606.png"), GL_REPEAT, GL_NEAREST) DE4 = es.toGPUShape(bs.createTextureQuad("DE_4.png"), GL_REPEAT, GL_NEAREST) #Noveno Semestre DG701 = es.toGPUShape(bs.createTextureQuad("DG_701.png"), GL_REPEAT, GL_NEAREST) DG702 = es.toGPUShape(bs.createTextureQuad("DG_702.png"), GL_REPEAT, GL_NEAREST) #Decimo Semestre DG801 = es.toGPUShape(bs.createTextureQuad("DG_801.png"), GL_REPEAT, GL_NEAREST) Tap_DP_101 = sg.SceneGraphNode( "Tap_DP_101") #Se crea la 'tapa' para el cubo Tap_DP_101.transform = tr.matmul( [tr.translate(0, 0, 0.252), tr.uniformScale(0.5)]) Tap_DP_101.childs += [DP101] Tap_DP_102 = sg.SceneGraphNode( "Tap_DP_102") #Se crea la 'tapa' para el cubo Tap_DP_102.transform = tr.matmul( [tr.translate(0, 0, 0.252), tr.uniformScale(0.5)]) Tap_DP_102.childs += [DP102] Tap_DP_103 = sg.SceneGraphNode( "Tap_DP_103") #Se crea la 'tapa' para el cubo Tap_DP_103.transform = tr.matmul( [tr.translate(0, 0, 0.252), tr.uniformScale(0.5)]) Tap_DP_103.childs += [DP103] Tap_DT_104 = sg.SceneGraphNode( "Tap_DT_104") #Se crea la 'tapa' para el cubo Tap_DT_104.transform = tr.matmul( [tr.translate(0, 0, 0.252), tr.uniformScale(0.5)]) Tap_DT_104.childs += [DT104] Tap_DT_105 = sg.SceneGraphNode( "Tap_DT_105") #Se crea la 'tapa' para el cubo Tap_DT_105.transform = tr.matmul( [tr.translate(0, 0, 0.252), tr.uniformScale(0.5)]) Tap_DT_105.childs += [DT105] Tap_DH_106 = sg.SceneGraphNode( "Tap_DH_106") #Se crea la 'tapa' para el cubo Tap_DH_106.transform = tr.matmul( [tr.translate(0, 0, 0.252), tr.uniformScale(0.5)]) Tap_DH_106.childs += [DH106] Tap_DH_107 = sg.SceneGraphNode( "Tap_DH_107") #Se crea la 'tapa' para el cubo Tap_DH_107.transform = tr.matmul( [tr.translate(0, 0, 0.252), tr.uniformScale(0.5)]) Tap_DH_107.childs += [DH107] Tap_DH_108 = sg.SceneGraphNode( "Tap_DH_108") #Se crea la 'tapa' para el cubo Tap_DH_108.transform = tr.matmul( [tr.translate(0, 0, 0.252), tr.uniformScale(0.5)]) Tap_DH_108.childs += [DH108] #Segundo año Tap_DGP_201 = sg.SceneGraphNode( "Tap_DGP_201") #Se crea la 'tapa' para el cubo Tap_DGP_201.transform = tr.matmul( [tr.translate(0, 0, 0.252), tr.uniformScale(0.5)]) Tap_DGP_201.childs += [DGP201] Tap_DGP_202 = sg.SceneGraphNode( "Tap_DGP_202") #Se crea la 'tapa' para el cubo Tap_DGP_202.transform = tr.matmul( [tr.translate(0, 0, 0.252), tr.uniformScale(0.5)]) Tap_DGP_202.childs += [DGP202] Tap_DGP_203 = sg.SceneGraphNode( "Tap_DGP_203") #Se crea la 'tapa' para el cubo Tap_DGP_203.transform = tr.matmul( [tr.translate(0, 0, 0.252), tr.uniformScale(0.5)]) Tap_DGP_203.childs += [DGP203] Tap_DGT_204 = sg.SceneGraphNode( "Tap_DGT_204") #Se crea la 'tapa' para el cubo Tap_DGT_204.transform = tr.matmul( [tr.translate(0, 0, 0.252), tr.uniformScale(0.5)]) Tap_DGT_204.childs += [DGT204] Tap_DGT_205 = sg.SceneGraphNode( "Tap_DGT_205") #Se crea la 'tapa' para el cubo Tap_DGT_205.transform = tr.matmul( [tr.translate(0, 0, 0.252), tr.uniformScale(0.5)]) Tap_DGT_205.childs += [DGT205] Tap_DGH_206 = sg.SceneGraphNode( "Tap_DGH_206") #Se crea la 'tapa' para el cubo Tap_DGH_206.transform = tr.matmul( [tr.translate(0, 0, 0.252), tr.uniformScale(0.5)]) Tap_DGH_206.childs += [DGH206] Tap_DGH_207 = sg.SceneGraphNode( "Tap_DGH_207") #Se crea la 'tapa' para el cubo Tap_DGH_207.transform = tr.matmul( [tr.translate(0, 0, 0.252), tr.uniformScale(0.5)]) Tap_DGH_207.childs += [DGH207] Tap_DGH_208 = sg.SceneGraphNode( "Tap_DGH_208") #Se crea la 'tapa' para el cubo Tap_DGH_208.transform = tr.matmul( [tr.translate(0, 0, 0.252), tr.uniformScale(0.5)]) Tap_DGH_208.childs += [DGH208] #Quinto Semestre Tap_DGP_301 = sg.SceneGraphNode( "Tap_DGP_301") #Se crea la 'tapa' para el cubo Tap_DGP_301.transform = tr.matmul( [tr.translate(0, 0, 0.252), tr.uniformScale(0.5)]) Tap_DGP_301.childs += [DGP301] Tap_DGT_302 = sg.SceneGraphNode( "Tap_DGT_302") #Se crea la 'tapa' para el cubo Tap_DGT_302.transform = tr.matmul( [tr.translate(0, 0, 0.252), tr.uniformScale(0.5)]) Tap_DGT_302.childs += [DGT302] Tap_DGT_303 = sg.SceneGraphNode( "Tap_DGT_303") #Se crea la 'tapa' para el cubo Tap_DGT_303.transform = tr.matmul( [tr.translate(0, 0, 0.252), tr.uniformScale(0.5)]) Tap_DGT_303.childs += [DGT303] Tap_DGT_304 = sg.SceneGraphNode( "Tap_DGT_304") #Se crea la 'tapa' para el cubo Tap_DGT_304.transform = tr.matmul( [tr.translate(0, 0, 0.252), tr.uniformScale(0.5)]) Tap_DGT_304.childs += [DGT304] Tap_DGH_305 = sg.SceneGraphNode( "Tap_DGH_305") #Se crea la 'tapa' para el cubo Tap_DGH_305.transform = tr.matmul( [tr.translate(0, 0, 0.252), tr.uniformScale(0.5)]) Tap_DGH_305.childs += [DGH305] Tap_DGH_306 = sg.SceneGraphNode( "Tap_DGH_306") #Se crea la 'tapa' para el cubo Tap_DGH_306.transform = tr.matmul( [tr.translate(0, 0, 0.252), tr.uniformScale(0.5)]) Tap_DGH_306.childs += [DGH306] Tap_DGH_307 = sg.SceneGraphNode( "Tap_DGH_307") #Se crea la 'tapa' para el cubo Tap_DGH_307.transform = tr.matmul( [tr.translate(0, 0, 0.252), tr.uniformScale(0.5)]) Tap_DGH_307.childs += [DGH307] Tap_DE_1 = sg.SceneGraphNode("Tap_DE_1") #Se crea la 'tapa' para el cubo Tap_DE_1.transform = tr.matmul( [tr.translate(0, 0, 0.252), tr.uniformScale(0.5)]) Tap_DE_1.childs += [DE1] #Sexto Semestre Tap_DGP_401 = sg.SceneGraphNode( "Tap_DGP_401") #Se crea la 'tapa' para el cubo Tap_DGP_401.transform = tr.matmul( [tr.translate(0, 0, 0.252), tr.uniformScale(0.5)]) Tap_DGP_401.childs += [DGP401] Tap_DGT_402 = sg.SceneGraphNode( "Tap_DGT_402") #Se crea la 'tapa' para el cubo Tap_DGT_402.transform = tr.matmul( [tr.translate(0, 0, 0.252), tr.uniformScale(0.5)]) Tap_DGT_402.childs += [DGT402] Tap_DGT_403 = sg.SceneGraphNode( "Tap_DGT_403") #Se crea la 'tapa' para el cubo Tap_DGT_403.transform = tr.matmul( [tr.translate(0, 0, 0.252), tr.uniformScale(0.5)]) Tap_DGT_403.childs += [DGT403] Tap_DGT_404 = sg.SceneGraphNode( "Tap_DGT_404") #Se crea la 'tapa' para el cubo Tap_DGT_404.transform = tr.matmul( [tr.translate(0, 0, 0.252), tr.uniformScale(0.5)]) Tap_DGT_404.childs += [DGT404] Tap_DGH_405 = sg.SceneGraphNode( "Tap_DGH_405") #Se crea la 'tapa' para el cubo Tap_DGH_405.transform = tr.matmul( [tr.translate(0, 0, 0.252), tr.uniformScale(0.5)]) Tap_DGH_405.childs += [DGH405] Tap_DGH_406 = sg.SceneGraphNode( "Tap_DGH_406") #Se crea la 'tapa' para el cubo Tap_DGH_406.transform = tr.matmul( [tr.translate(0, 0, 0.252), tr.uniformScale(0.5)]) Tap_DGH_406.childs += [DGH406] Tap_DGH_407 = sg.SceneGraphNode( "Tap_DGH_407") #Se crea la 'tapa' para el cubo Tap_DGH_407.transform = tr.matmul( [tr.translate(0, 0, 0.252), tr.uniformScale(0.5)]) Tap_DGH_407.childs += [DGH407] Tap_DE_2 = sg.SceneGraphNode("Tap_DE_2") #Se crea la 'tapa' para el cubo Tap_DE_2.transform = tr.matmul( [tr.translate(0, 0, 0.252), tr.uniformScale(0.5)]) Tap_DE_2.childs += [DE2] #Septimo Semestre Tap_DGP_501 = sg.SceneGraphNode( "Tap_DGP_501") #Se crea la 'tapa' para el cubo Tap_DGP_501.transform = tr.matmul( [tr.translate(0, 0, 0.252), tr.uniformScale(0.5)]) Tap_DGP_501.childs += [DGP501] Tap_DGP_502 = sg.SceneGraphNode( "Tap_DGP_502") #Se crea la 'tapa' para el cubo Tap_DGP_502.transform = tr.matmul( [tr.translate(0, 0, 0.252), tr.uniformScale(0.5)]) Tap_DGP_502.childs += [DGP502] Tap_DGT_503 = sg.SceneGraphNode( "Tap_DGT_503") #Se crea la 'tapa' para el cubo Tap_DGT_503.transform = tr.matmul( [tr.translate(0, 0, 0.252), tr.uniformScale(0.5)]) Tap_DGT_503.childs += [DGT503] Tap_DGH_504 = sg.SceneGraphNode( "Tap_DGH_504") #Se crea la 'tapa' para el cubo Tap_DGH_504.transform = tr.matmul( [tr.translate(0, 0, 0.252), tr.uniformScale(0.5)]) Tap_DGH_504.childs += [DGH504] Tap_DGH_505 = sg.SceneGraphNode( "Tap_DGH_505") #Se crea la 'tapa' para el cubo Tap_DGH_505.transform = tr.matmul( [tr.translate(0, 0, 0.252), tr.uniformScale(0.5)]) Tap_DGH_505.childs += [DGH505] Tap_DGH_506 = sg.SceneGraphNode( "Tap_DGH_506") #Se crea la 'tapa' para el cubo Tap_DGH_506.transform = tr.matmul( [tr.translate(0, 0, 0.252), tr.uniformScale(0.5)]) Tap_DGH_506.childs += [DGH506] Tap_DGH_507 = sg.SceneGraphNode( "Tap_DGH_507") #Se crea la 'tapa' para el cubo Tap_DGH_507.transform = tr.matmul( [tr.translate(0, 0, 0.252), tr.uniformScale(0.5)]) Tap_DGH_507.childs += [DGH507] Tap_DE_3 = sg.SceneGraphNode("Tap_DE_3") #Se crea la 'tapa' para el cubo Tap_DE_3.transform = tr.matmul( [tr.translate(0, 0, 0.252), tr.uniformScale(0.5)]) Tap_DE_3.childs += [DE3] #Octavo Semestre Tap_DGP_601 = sg.SceneGraphNode( "Tap_DGP_601") #Se crea la 'tapa' para el cubo Tap_DGP_601.transform = tr.matmul( [tr.translate(0, 0, 0.252), tr.uniformScale(0.5)]) Tap_DGP_601.childs += [DGP601] Tap_DGP_602 = sg.SceneGraphNode( "Tap_DGP_602") #Se crea la 'tapa' para el cubo Tap_DGP_602.transform = tr.matmul( [tr.translate(0, 0, 0.252), tr.uniformScale(0.5)]) Tap_DGP_602.childs += [DGP602] Tap_DGT_603 = sg.SceneGraphNode( "Tap_DGT_603") #Se crea la 'tapa' para el cubo Tap_DGT_603.transform = tr.matmul( [tr.translate(0, 0, 0.252), tr.uniformScale(0.5)]) Tap_DGT_603.childs += [DGT603] Tap_DGH_604 = sg.SceneGraphNode( "Tap_DGH_604") #Se crea la 'tapa' para el cubo Tap_DGH_604.transform = tr.matmul( [tr.translate(0, 0, 0.252), tr.uniformScale(0.5)]) Tap_DGH_604.childs += [DGH604] Tap_DGH_605 = sg.SceneGraphNode( "Tap_DGH_605") #Se crea la 'tapa' para el cubo Tap_DGH_605.transform = tr.matmul( [tr.translate(0, 0, 0.252), tr.uniformScale(0.5)]) Tap_DGH_605.childs += [DGH605] Tap_DGH_606 = sg.SceneGraphNode( "Tap_DGH_606") #Se crea la 'tapa' para el cubo Tap_DGH_606.transform = tr.matmul( [tr.translate(0, 0, 0.252), tr.uniformScale(0.5)]) Tap_DGH_606.childs += [DGH606] Tap_DE_4 = sg.SceneGraphNode("Tap_DE_4") #Se crea la 'tapa' para el cubo Tap_DE_4.transform = tr.matmul( [tr.translate(0, 0, 0.252), tr.uniformScale(0.5)]) Tap_DE_4.childs += [DE4] #Noveno semestre Tap_DG_701 = sg.SceneGraphNode( "Tap_DG_701") #Se crea la 'tapa' para el cubo Tap_DG_701.transform = tr.matmul( [tr.translate(0, 0, 0.252), tr.uniformScale(0.5)]) Tap_DG_701.childs += [DG701] Tap_DG_702 = sg.SceneGraphNode( "Tap_DG_702") #Se crea la 'tapa' para el cubo Tap_DG_702.transform = tr.matmul( [tr.translate(0, 0, 0.252), tr.uniformScale(0.5)]) Tap_DG_702.childs += [DG702] #Decimo semestre Tap_DG_801 = sg.SceneGraphNode( "Tap_DG_801") #Se crea la 'tapa' para el cubo Tap_DG_801.transform = tr.matmul( [tr.translate(0, 0, 0.252), tr.uniformScale(0.5)]) Tap_DG_801.childs += [DG801] if codigo == 'DP_101': return Tap_DP_101 elif codigo == 'DP_102': return Tap_DP_102 elif codigo == 'DP_103': return Tap_DP_103 elif codigo == 'DT_104': return Tap_DT_104 elif codigo == 'DT_105': return Tap_DT_105 elif codigo == 'DH_106': return Tap_DH_106 elif codigo == 'DH_107': return Tap_DH_107 elif codigo == 'DH_108': return Tap_DH_108 elif codigo == 'DGP_201': return Tap_DGP_201 elif codigo == 'DGP_202': return Tap_DGP_202 elif codigo == 'DGP_203': return Tap_DGP_203 elif codigo == 'DGT_204': return Tap_DGT_204 elif codigo == 'DGT_205': return Tap_DGT_205 elif codigo == 'DGH_206': return Tap_DGH_206 elif codigo == 'DGH_207': return Tap_DGH_207 elif codigo == 'DGH_208': return Tap_DGH_208 elif codigo == 'DGP_301': return Tap_DGP_301 elif codigo == 'DGT_302': return Tap_DGT_302 elif codigo == 'DGT_303': return Tap_DGT_303 elif codigo == 'DGT_304': return Tap_DGT_304 elif codigo == 'DGH_305': return Tap_DGH_305 elif codigo == 'DGH_306': return Tap_DGH_306 elif codigo == 'DGH_307': return Tap_DGH_307 elif codigo == 'DE_1': return Tap_DE_1 elif codigo == 'DGP_401': return Tap_DGP_401 elif codigo == 'DGT_402': return Tap_DGT_402 elif codigo == 'DGT_403': return Tap_DGT_403 elif codigo == 'DGT_404': return Tap_DGT_404 elif codigo == 'DGH_405': return Tap_DGH_405 elif codigo == 'DGH_406': return Tap_DGH_406 elif codigo == 'DGH_407': return Tap_DGH_407 elif codigo == 'DE_2': return Tap_DE_2 elif codigo == 'DGP_501': return Tap_DGP_501 elif codigo == 'DGP_502': return Tap_DGP_502 elif codigo == 'DGT_503': return Tap_DGT_503 elif codigo == 'DGH_504': return Tap_DGH_504 elif codigo == 'DGH_505': return Tap_DGH_505 elif codigo == 'DGH_506': return Tap_DGH_506 elif codigo == 'DGH_507': return Tap_DGH_507 elif codigo == 'DE_3': return Tap_DE_3 elif codigo == 'DGP_601': return Tap_DGP_601 elif codigo == 'DGP_602': return Tap_DGP_602 elif codigo == 'DGT_603': return Tap_DGT_603 elif codigo == 'DGH_604': return Tap_DGH_604 elif codigo == 'DGH_605': return Tap_DGH_605 elif codigo == 'DGH_606': return Tap_DGH_606 elif codigo == 'DE_4': return Tap_DE_4 elif codigo == 'DG_701': return Tap_DG_701 elif codigo == 'DG_702': return Tap_DG_702 elif codigo == 'DG_801': return Tap_DG_801
def crearCurso(cubo): cuboRojo = cubo #Primer año DP101 = es.toGPUShape(bs.createTextureQuad("DP_101.png"),GL_REPEAT, GL_NEAREST) DP102 = es.toGPUShape(bs.createTextureQuad("DP_102.png"),GL_REPEAT, GL_NEAREST) DP103 = es.toGPUShape(bs.createTextureQuad("DP_103.png"),GL_REPEAT, GL_NEAREST) DT104 = es.toGPUShape(bs.createTextureQuad("DT_104.png"),GL_REPEAT, GL_NEAREST) DT105 = es.toGPUShape(bs.createTextureQuad("DT_105.png"),GL_REPEAT, GL_NEAREST) DH106 = es.toGPUShape(bs.createTextureQuad("DH_106.png"),GL_REPEAT, GL_NEAREST) DH107 = es.toGPUShape(bs.createTextureQuad("DH_107.png"),GL_REPEAT, GL_NEAREST) DH108 = es.toGPUShape(bs.createTextureQuad("DH_108.png"),GL_REPEAT, GL_NEAREST) #Segundo año DGP201 = es.toGPUShape(bs.createTextureQuad("DGP_201.png"),GL_REPEAT, GL_NEAREST) DGP202 = es.toGPUShape(bs.createTextureQuad("DGP_202.png"),GL_REPEAT, GL_NEAREST) DGP203 = es.toGPUShape(bs.createTextureQuad("DGP_203.png"),GL_REPEAT, GL_NEAREST) DGT204 = es.toGPUShape(bs.createTextureQuad("DGT_204.png"),GL_REPEAT, GL_NEAREST) DGT205 = es.toGPUShape(bs.createTextureQuad("DGT_205.png"),GL_REPEAT, GL_NEAREST) DGH206 = es.toGPUShape(bs.createTextureQuad("DGH_206.png"),GL_REPEAT, GL_NEAREST) DGH207 = es.toGPUShape(bs.createTextureQuad("DGH_207.png"),GL_REPEAT, GL_NEAREST) DGH208 = es.toGPUShape(bs.createTextureQuad("DGH_208.png"),GL_REPEAT, GL_NEAREST) #Quinto Semestre DGP301 = es.toGPUShape(bs.createTextureQuad("DGP_301.png"),GL_REPEAT, GL_NEAREST) DGT302 = es.toGPUShape(bs.createTextureQuad("DGT_302.png"),GL_REPEAT, GL_NEAREST) DGT303 = es.toGPUShape(bs.createTextureQuad("DGT_303.png"),GL_REPEAT, GL_NEAREST) DGT304 = es.toGPUShape(bs.createTextureQuad("DGT_304.png"),GL_REPEAT, GL_NEAREST) DGH305 = es.toGPUShape(bs.createTextureQuad("DGH_305.png"),GL_REPEAT, GL_NEAREST) DGH306 = es.toGPUShape(bs.createTextureQuad("DGH_306.png"),GL_REPEAT, GL_NEAREST) DGH307 = es.toGPUShape(bs.createTextureQuad("DGH_307.png"),GL_REPEAT, GL_NEAREST) DE1 = es.toGPUShape(bs.createTextureQuad("DE_1.png"),GL_REPEAT, GL_NEAREST) #Sexto Semestre DGP401 = es.toGPUShape(bs.createTextureQuad("DGP_401.png"),GL_REPEAT, GL_NEAREST) DGT402 = es.toGPUShape(bs.createTextureQuad("DGT_402.png"),GL_REPEAT, GL_NEAREST) DGT403 = es.toGPUShape(bs.createTextureQuad("DGT_403.png"),GL_REPEAT, GL_NEAREST) DGT404 = es.toGPUShape(bs.createTextureQuad("DGT_404.png"),GL_REPEAT, GL_NEAREST) DGH405 = es.toGPUShape(bs.createTextureQuad("DGH_405.png"),GL_REPEAT, GL_NEAREST) DGH406 = es.toGPUShape(bs.createTextureQuad("DGH_406.png"),GL_REPEAT, GL_NEAREST) DGH407 = es.toGPUShape(bs.createTextureQuad("DGH_407.png"),GL_REPEAT, GL_NEAREST) DE2 = es.toGPUShape(bs.createTextureQuad("DE_2.png"),GL_REPEAT, GL_NEAREST) #Septimo Semestre DGP501 = es.toGPUShape(bs.createTextureQuad("DGP_501.png"),GL_REPEAT, GL_NEAREST) DGP502 = es.toGPUShape(bs.createTextureQuad("DGP_502.png"),GL_REPEAT, GL_NEAREST) DGT503 = es.toGPUShape(bs.createTextureQuad("DGT_503.png"),GL_REPEAT, GL_NEAREST) DGH504 = es.toGPUShape(bs.createTextureQuad("DGH_504.png"),GL_REPEAT, GL_NEAREST) DGH505 = es.toGPUShape(bs.createTextureQuad("DGH_505.png"),GL_REPEAT, GL_NEAREST) DGH506 = es.toGPUShape(bs.createTextureQuad("DGH_506.png"),GL_REPEAT, GL_NEAREST) DGH507 = es.toGPUShape(bs.createTextureQuad("DGH_507.png"),GL_REPEAT, GL_NEAREST) DE3 = es.toGPUShape(bs.createTextureQuad("DE_2.png"),GL_REPEAT, GL_NEAREST) #Octavo Semestre DGP601 = es.toGPUShape(bs.createTextureQuad("DGP_601.png"),GL_REPEAT, GL_NEAREST) DGP602 = es.toGPUShape(bs.createTextureQuad("DGP_602.png"),GL_REPEAT, GL_NEAREST) DGT603 = es.toGPUShape(bs.createTextureQuad("DGT_603.png"),GL_REPEAT, GL_NEAREST) DGH604 = es.toGPUShape(bs.createTextureQuad("DGH_604.png"),GL_REPEAT, GL_NEAREST) DGH605 = es.toGPUShape(bs.createTextureQuad("DGH_605.png"),GL_REPEAT, GL_NEAREST) DGH606 = es.toGPUShape(bs.createTextureQuad("DGH_606.png"),GL_REPEAT, GL_NEAREST) DE4 = es.toGPUShape(bs.createTextureQuad("DE_4.png"),GL_REPEAT, GL_NEAREST) #Noveno Semestre DG701 = es.toGPUShape(bs.createTextureQuad("DG_701.png"),GL_REPEAT, GL_NEAREST) DG702 = es.toGPUShape(bs.createTextureQuad("DG_702.png"),GL_REPEAT, GL_NEAREST) #Decimo Semestre DG801 = es.toGPUShape(bs.createTextureQuad("DG_801.png"),GL_REPEAT, GL_NEAREST) #Aqui se comienzan a crear los cursos #Primer año Tap_DP_101 = sg.SceneGraphNode("Tap_DP_101") #Se crea la 'tapa' para el cubo Tap_DP_101.transform = tr.matmul([tr.translate(0,0,0.252),tr.uniformScale(0.5)]) Tap_DP_101.childs += [DP101] TDP_101 = sg.SceneGraphNode("TDP_101") #Se crea el cubo completo ubicado en la posicion correcta TDP_101.transform = tr.translate(-2.1,2.1,0) TDP_101.childs += [cuboRojo, Tap_DP_101] DP_101 = sg.SceneGraphNode("DP_101") #Se crea el cubo completo DP_101.childs += [TDP_101] CDP_101 = cc.Curso('DP_101',[],-2.1,2.1,0,['DGP_201','DG_701','DG_702']) Tap_DP_102 = sg.SceneGraphNode("Tap_DP_102") #Se crea la 'tapa' para el cubo Tap_DP_102.transform = tr.matmul([tr.translate(0,0,0.252),tr.uniformScale(0.5)]) Tap_DP_102.childs += [DP102] TDP_102 = sg.SceneGraphNode("TDP_102") #Se crea el cubo completo ubicado en la posicion correcta TDP_102.transform = tr.translate(-1.5,2.1,0) TDP_102.childs += [cuboRojo, Tap_DP_102] DP_102 = sg.SceneGraphNode("DP_102") #Se crea el cubo completo DP_102.childs += [TDP_102] CDP_102 = cc.Curso('DP_102',[],-1.5,2.1,0,['DGP_202','DG_701','DG_702']) Tap_DP_103 = sg.SceneGraphNode("Tap_DP_103") #Se crea la 'tapa' para el cubo Tap_DP_103.transform = tr.matmul([tr.translate(0,0,0.252),tr.uniformScale(0.5)]) Tap_DP_103.childs += [DP103] TDP_103 = sg.SceneGraphNode("TDP_103") #Se crea el cubo completo ubicado en la posicion correcta TDP_103.transform = tr.translate(-0.9,2.1,0) TDP_103.childs += [cuboRojo, Tap_DP_103] DP_103 = sg.SceneGraphNode("DP_103") #Se crea el cubo completo DP_103.childs += [TDP_103] CDP_103 = cc.Curso('DP_103',[],-0.9,2.1,0,['DGP_203','DG_701','DG_702']) Tap_DT_104 = sg.SceneGraphNode("Tap_DT_104") #Se crea la 'tapa' para el cubo Tap_DT_104.transform = tr.matmul([tr.translate(0, 0,0.252),tr.uniformScale(0.5)]) Tap_DT_104.childs += [DT104] TDT_104 = sg.SceneGraphNode("TDT_104") #Se crea el cubo completo ubicado en la posicion correcta TDT_104.transform = tr.translate(-0.3,2.1,0) TDT_104.childs += [cuboRojo, Tap_DT_104] DT_104 = sg.SceneGraphNode("DT_104") #Se crea el cubo completo DT_104.childs += [TDT_104] CDT_104 = cc.Curso('DT_104',[],-0.3,2.1,0,['DGT_303','DG_701','DG_702']) Tap_DT_105 = sg.SceneGraphNode("Tap_DT_105") #Se crea la 'tapa' para el cubo Tap_DT_105.transform = tr.matmul([tr.translate(0,0,0.252),tr.uniformScale(0.5)]) Tap_DT_105.childs += [DT105] TDT_105 = sg.SceneGraphNode("TDT_105") #Se crea el cubo completo ubicado en la pisicion correcta TDT_105.transform = tr.translate(0.3,2.1,0) TDT_105.childs += [cuboRojo, Tap_DT_105] DT_105 = sg.SceneGraphNode("DT_105") #Se crea el cubo completo DT_105.childs += [ TDT_105] CDT_105 = cc.Curso('DT_105',[],0.3,2.1,0,['DGT_205','DG_701','DG_702']) Tap_DH_106 = sg.SceneGraphNode("Tap_DH_106") #Se crea la 'tapa' para el cubo Tap_DH_106.transform = tr.matmul([tr.translate(0,0,0.252),tr.uniformScale(0.5)]) Tap_DH_106.childs += [DH106] TDH_106 = sg.SceneGraphNode("TDH_106") #Se crea el cubo completo ubicado en la posicion correcta TDH_106.transform = tr.translate(0.9,2.1,0) TDH_106.childs += [cuboRojo, Tap_DH_106] DH_106 = sg.SceneGraphNode("DH_106") #Se crea el cubo completo DH_106.childs += [TDH_106] CDH_106 = cc.Curso('DH_106',[],0.9,2.1,0,['DGH_206','DG_701','DG_702']) Tap_DH_107 = sg.SceneGraphNode("Tap_DH_107") #Se crea la 'tapa' para el cubo Tap_DH_107.transform = tr.matmul([tr.translate(0,0,0.252),tr.uniformScale(0.5)]) Tap_DH_107.childs += [DH107] TDH_107 = sg.SceneGraphNode("TDH_107") #Se crea el cubo completo ubicado en la posicion correcta TDH_107.transform = tr.translate(1.5,2.1,0) TDH_107.childs += [cuboRojo, Tap_DH_107] DH_107 = sg.SceneGraphNode("DH_107") #Se crea el cubo completo DH_107.childs += [TDH_107] CDH_107 = cc.Curso('DH_107',[],1.5,2.1,0,['DGH_305','DG_701','DG_702']) Tap_DH_108 = sg.SceneGraphNode("Tap_DH_108") #Se crea la 'tapa' para el cubo Tap_DH_108.transform = tr.matmul([tr.translate(0,0,0.252),tr.uniformScale(0.5)]) Tap_DH_108.childs += [DH108] TDH_108 = sg.SceneGraphNode("TDH_108") #Se crea el cubo completo ubicado en la posicion correcta TDH_108.transform = tr.translate(2.1,2.1,0) TDH_108.childs += [cuboRojo, Tap_DH_108] DH_108 = sg.SceneGraphNode("DH_108") #Se crea el cubo completo DH_108.childs += [TDH_108] CDH_108 = cc.Curso('DH_108',[],2.1,2.1,0,['DGH_208','DG_701','DG_702']) #Segundo año Tap_DGP_201 = sg.SceneGraphNode("Tap_DGP_201") #Se crea la 'tapa' para el cubo Tap_DGP_201.transform = tr.matmul([tr.translate(0,0,0.252),tr.uniformScale(0.5)]) Tap_DGP_201.childs += [DGP201] TDGP_201 = sg.SceneGraphNode("TDGP_201") #Se crea el cubo completo ubicado en la posicion correcta TDGP_201.transform = tr.translate(-2.1,1.5,0) TDGP_201.childs += [cuboRojo, Tap_DGP_201] DGP_201 = sg.SceneGraphNode("DGP_201") #Se crea el cubo completo DGP_201.childs += [TDGP_201] CDGP_201 = cc.Curso('DGP_201',['DP_101'],-2.1,1.5,0,['DGP_301','DG_701','DG_702']) Tap_DGP_202 = sg.SceneGraphNode("Tap_DGP_202") #Se crea la 'tapa' para el cubo Tap_DGP_202.transform = tr.matmul([tr.translate(0,0,0.252),tr.uniformScale(0.5)]) Tap_DGP_202.childs += [DGP202] TDGP_202 = sg.SceneGraphNode("TDGP_202") #Se crea el cubo completo ubicado en la posicion correcta TDGP_202.transform = tr.translate(-1.5,1.5,0) TDGP_202.childs += [cuboRojo, Tap_DGP_202] DGP_202 = sg.SceneGraphNode("DGP_202") #Se crea el cubo completo DGP_202.childs += [TDGP_202] CDGP_202 = cc.Curso('DGP_202',['DP_102'],-1.5,1.5,0,['DG_701','DG_702']) Tap_DGP_203 = sg.SceneGraphNode("Tap_DGP_203") #Se crea la 'tapa' para el cubo Tap_DGP_203.transform = tr.matmul([tr.translate(0,0,0.252),tr.uniformScale(0.5)]) Tap_DGP_203.childs += [DGP203] TDGP_203 = sg.SceneGraphNode("TDGP_203") #Se crea el cubo completo ubicado en la posicion correcta TDGP_203.transform = tr.translate(-0.9,1.5,0) TDGP_203.childs += [cuboRojo, Tap_DGP_203] DGP_203 = sg.SceneGraphNode("DGP_203") #Se crea el cubo completo DGP_203.childs += [TDGP_203] CDGP_203 = cc.Curso('DGP_203',['DP_103'],-0.9,1.5,0,['DGP_301','DG_701','DG_702']) Tap_DGT_204 = sg.SceneGraphNode("Tap_DGT_204") #Se crea la 'tapa' para el cubo Tap_DGT_204.transform = tr.matmul([tr.translate(0,0,0.252),tr.uniformScale(0.5)]) Tap_DGT_204.childs += [DGT204] TDGT_204 = sg.SceneGraphNode("TDGT_204") #Se crea el cubo completo ubicado en la posicion correcta TDGT_204.transform = tr.translate(-0.3,1.5,0) TDGT_204.childs += [cuboRojo, Tap_DGT_204] DGT_204 = sg.SceneGraphNode("DGT_204") #Se crea el cubo completo DGT_204.childs += [TDGT_204] CDGT_204 = cc.Curso('DGT_204',[],-0.3,1.5,0,['DGT_304','DG_701','DG_702']) Tap_DGT_205 = sg.SceneGraphNode("Tap_DGT_205") #Se crea la 'tapa' para el cubo Tap_DGT_205.transform = tr.matmul([tr.translate(0,0,0.252),tr.uniformScale(0.5)]) Tap_DGT_205.childs += [DGT205] TDGT_205 = sg.SceneGraphNode("TDGT_205") #Se crea el cubo completo ubicado en la posicion correcta TDGT_205.transform = tr.translate(0.3,1.5,0) TDGT_205.childs += [cuboRojo, Tap_DGT_205] DGT_205 = sg.SceneGraphNode("DGT_205") #Se crea el cubo completo DGT_205.childs += [TDGT_205] CDGT_205 = cc.Curso('DGT_205',['DT_105'],0.3,1.5,0,['DGT_303', 'DGT_302','DG_701','DG_702']) Tap_DGH_206 = sg.SceneGraphNode("Tap_DGH_206") #Se crea la 'tapa' para el cubo Tap_DGH_206.transform = tr.matmul([tr.translate(0,0,0.252),tr.uniformScale(0.5)]) Tap_DGH_206.childs += [DGH206] TDGH_206 = sg.SceneGraphNode("TDGH_206") #Se crea el cubo completo ubicado en la posicion correcta TDGH_206.transform = tr.translate(0.9,1.5,0) TDGH_206.childs += [cuboRojo, Tap_DGH_206] DGH_206 = sg.SceneGraphNode("DGH_206") #Se crea el cubo completo DGH_206.childs += [TDGH_206] CDGH_206 = cc.Curso('DGH_206',['DH_106'],0.9,1.5,0,['DG_701','DG_702']) Tap_DGH_207 = sg.SceneGraphNode("Tap_DGH_207") #Se crea la 'tapa' para el cubo Tap_DGH_207.transform = tr.matmul([tr.translate(0,0,0.252),tr.uniformScale(0.5)]) Tap_DGH_207.childs += [DGH207] TDGH_207 = sg.SceneGraphNode("TDGH_207") #Se crea el cubo completo ubicado en la posicion correcta TDGH_207.transform = tr.translate(1.5,1.5,0) TDGH_207.childs += [cuboRojo, Tap_DGH_207] DGH_207 = sg.SceneGraphNode("DGH_207") #Se crea el cubo completo DGH_207.childs += [TDGH_207] CDGH_207 = cc.Curso('DGH_207',[],1.5,1.5,0,['DGP_301', 'DGH_306','DG_701','DG_702']) Tap_DGH_208 = sg.SceneGraphNode("Tap_DGH_208") #Se crea la 'tapa' para el cubo Tap_DGH_208.transform = tr.matmul([tr.translate(0,0,0.252),tr.uniformScale(0.5)]) Tap_DGH_208.childs += [DGH208] TDGH_208 = sg.SceneGraphNode("TDGH_208") #Se crea el cubo completo ubicado en la posicion correcta TDGH_208.transform = tr.translate(2.1,1.5,0) TDGH_208.childs += [cuboRojo, Tap_DGH_208] DGH_208 = sg.SceneGraphNode("DGH_208") #Se crea el cubo completo DGH_208.childs += [TDGH_208] CDGH_208 = cc.Curso('DGH_208',['DH_108'],0.9,1.5,0,['DGH_307','DG_701','DG_702']) #Quinto Semestre Tap_DGP_301 = sg.SceneGraphNode("Tap_DGP_301") #Se crea la 'tapa' para el cubo Tap_DGP_301.transform = tr.matmul([tr.translate(0,0,0.252),tr.uniformScale(0.5)]) Tap_DGP_301.childs += [DGP301] TDGP_301 = sg.SceneGraphNode("TDGP_301") #Se crea el cubo completo ubicado en la posicion correcta TDGP_301.transform = tr.translate(-2.1,0.9,0) TDGP_301.childs += [cuboRojo, Tap_DGP_301] DGP_301 = sg.SceneGraphNode("DGP_301") #Se crea el cubo completo DGP_301.childs += [TDGP_301] CDGP_301 = cc.Curso('DGP_301',['DGP_201','DGP_203','DGH_207'],-2.1,0.9,0,['DGP_401','DG_701','DG_702']) Tap_DGT_302 = sg.SceneGraphNode("Tap_DGT_302") #Se crea la 'tapa' para el cubo Tap_DGT_302.transform = tr.matmul([tr.translate(0,0,0.252),tr.uniformScale(0.5)]) Tap_DGT_302.childs += [DGT302] TDGT_302 = sg.SceneGraphNode("TDGT_302") #Se crea el cubo completo ubicado en la posicion correcta TDGT_302.transform = tr.translate(-1.5,0.9,0) TDGT_302.childs += [cuboRojo, Tap_DGT_302] DGT_302 = sg.SceneGraphNode("DGT_302") #Se crea el cubo completo DGT_302.childs += [TDGT_302] CDGT_302 = cc.Curso('DGT_302',['DGT_205'],-1.5,0.9,0,['DGT_402','DG_701','DG_702']) Tap_DGT_303 = sg.SceneGraphNode("Tap_DGT_303") #Se crea la 'tapa' para el cubo Tap_DGT_303.transform = tr.matmul([tr.translate(0,0,0.252),tr.uniformScale(0.5)]) Tap_DGT_303.childs += [DGT303] TDGT_303 = sg.SceneGraphNode("TDGT_303") #Se crea el cubo completo ubicado en la posicion correcta TDGT_303.transform = tr.translate(-0.9,0.9,0) TDGT_303.childs += [cuboRojo, Tap_DGT_303] DGT_303 = sg.SceneGraphNode("DGT_303") #Se crea el cubo completo DGT_303.childs += [TDGT_303] CDGT_303 = cc.Curso('DGT_303',['DGT_205','DT_104'],-0.9,0.9,0,['DGT_403','DG_701','DG_702']) Tap_DGT_304 = sg.SceneGraphNode("Tap_DGT_304") #Se crea la 'tapa' para el cubo Tap_DGT_304.transform = tr.matmul([tr.translate(0,0,0.252),tr.uniformScale(0.5)]) Tap_DGT_304.childs += [DGT304] TDGT_304 = sg.SceneGraphNode("TDGT_304") #Se crea el cubo completo ubicado en la posicion correcta TDGT_304.transform = tr.translate(-0.3,0.9,0) TDGT_304.childs += [cuboRojo, Tap_DGT_304] DGT_304 = sg.SceneGraphNode("DGT_304") #Se crea el cubo completo DGT_304.childs += [TDGT_304] CDGT_304 = cc.Curso('DGT_304',['DGT_204'],-0.3,0.9,0,['DGT_404','DG_701','DG_702']) Tap_DGH_305 = sg.SceneGraphNode("Tap_DGH_305") #Se crea la 'tapa' para el cubo Tap_DGH_305.transform = tr.matmul([tr.translate(0,0,0.252),tr.uniformScale(0.5)]) Tap_DGH_305.childs += [DGH305] TDGH_305 = sg.SceneGraphNode("TDGH_305") #Se crea el cubo completo ubicado en la posicion correcta TDGH_305.transform = tr.translate(0.3,0.9,0) TDGH_305.childs += [cuboRojo, Tap_DGH_305] DGH_305 = sg.SceneGraphNode("DGH_305") #Se crea el cubo completo DGH_305.childs += [TDGH_305] CDGH_305 = cc.Curso('DGH_305',['DH_107'],0.3,0.9,0,['DGH_505','DG_701','DG_702']) Tap_DGH_306 = sg.SceneGraphNode("Tap_DGH_306") #Se crea la 'tapa' para el cubo Tap_DGH_306.transform = tr.matmul([tr.translate(0,0,0.252),tr.uniformScale(0.5)]) Tap_DGH_306.childs += [DGH306] TDGH_306 = sg.SceneGraphNode("TDGH_306") #Se crea el cubo completo ubicado en la posicion correcta TDGH_306.transform = tr.translate(0.9,0.9,0) TDGH_306.childs += [cuboRojo, Tap_DGH_306] DGH_306 = sg.SceneGraphNode("DGH_306") #Se crea el cubo completo DGH_306.childs += [TDGH_306] CDGH_306 = cc.Curso('DGH_306',['DGH_207'],0.9,0.9,0,['DGP_401', 'DGH_406','DG_701','DG_702']) Tap_DGH_307 = sg.SceneGraphNode("Tap_DGH_307") #Se crea la 'tapa' para el cubo Tap_DGH_307.transform = tr.matmul([tr.translate(0,0,0.252),tr.uniformScale(0.5)]) Tap_DGH_307.childs += [DGH307] TDGH_307 = sg.SceneGraphNode("TDGH_307") #Se crea el cubo completo ubicado en la posicion correcta TDGH_307.transform = tr.translate(1.5,0.9,0) TDGH_307.childs += [cuboRojo, Tap_DGH_307] DGH_307 = sg.SceneGraphNode("DGH_307") #Se crea el cubo completo DGH_307.childs += [TDGH_307] CDGH_307 = cc.Curso('DGH_307',['DGH_208'],1.5,0.9,0, ['DGP_401', 'DGH_407','DG_701','DG_702']) Tap_DE_1 = sg.SceneGraphNode("Tap_DE_1") #Se crea la 'tapa' para el cubo Tap_DE_1.transform = tr.matmul([tr.translate(0,0,0.252),tr.uniformScale(0.5)]) Tap_DE_1.childs += [DE1] TDE_1 = sg.SceneGraphNode("TDE_1") #Se crea el cubo completo ubicado en la posicion correcta TDE_1.transform = tr.translate(2.1,0.9,0) TDE_1.childs += [cuboRojo, Tap_DE_1] DE_1 = sg.SceneGraphNode("DE_1") #Se crea el cubo completo DE_1.childs += [TDE_1] CDE_1 = cc.Curso('DE_1',[],2.1,0.9,0,['DE_3','DE_4','DG_701','DG_702']) #Sexto Semestre Tap_DGP_401 = sg.SceneGraphNode("Tap_DGP_401") #Se crea la 'tapa' para el cubo Tap_DGP_401.transform = tr.matmul([tr.translate(0,0,0.252),tr.uniformScale(0.5)]) Tap_DGP_401.childs += [DGP401] TDGP_401 = sg.SceneGraphNode("TDGP_401") #Se crea el cubo completo ubicado en la posicion correcta TDGP_401.transform = tr.translate(-2.1,0.3,0) TDGP_401.childs += [cuboRojo, Tap_DGP_401] DGP_401 = sg.SceneGraphNode("DGP_401") #Se crea el cubo completo DGP_401.childs += [TDGP_401] CDGP_401 = cc.Curso('DGP_401',['DGH_307','DGP_301','DGH_306'],-2.1,0.3,0,['DGP_501','DG_701','DG_702']) Tap_DGT_402 = sg.SceneGraphNode("Tap_DGT_402") #Se crea la 'tapa' para el cubo Tap_DGT_402.transform = tr.matmul([tr.translate(0,0,0.252),tr.uniformScale(0.5)]) Tap_DGT_402.childs += [DGT402] TDGT_402 = sg.SceneGraphNode("TDGT_402") #Se crea el cubo completo ubicado en la posicion correcta TDGT_402.transform = tr.translate(-1.5,0.3,0) TDGT_402.childs += [cuboRojo, Tap_DGT_402] DGT_402 = sg.SceneGraphNode("DGT_402") #Se crea el cubo completo DGT_402.childs += [TDGT_402] CDGT_402 = cc.Curso('DGT_402',['DGT_302'],-1.5,0.3,0,['DGH_507','DG_701','DG_702']) Tap_DGT_403 = sg.SceneGraphNode("Tap_DGT_403") #Se crea la 'tapa' para el cubo Tap_DGT_403.transform = tr.matmul([tr.translate(0,0,0.252),tr.uniformScale(0.5)]) Tap_DGT_403.childs += [DGT403] TDGT_403 = sg.SceneGraphNode("TDGT_403") #Se crea el cubo completo ubicado en la posicion correcta TDGT_403.transform = tr.translate(-0.9,0.3,0) TDGT_403.childs += [cuboRojo, Tap_DGT_403] DGT_403 = sg.SceneGraphNode("DGT_403") #Se crea el cubo completo DGT_403.childs += [TDGT_403] CDGT_403 = cc.Curso('DGT_403',['DGT_303'],-0.9,0.3,0,['DGP_501', 'DGP_502','DG_701','DG_702']) Tap_DGT_404 = sg.SceneGraphNode("Tap_DGT_404") #Se crea la 'tapa' para el cubo Tap_DGT_404.transform = tr.matmul([tr.translate(0,0,0.252),tr.uniformScale(0.5)]) Tap_DGT_404.childs += [DGT404] TDGT_404 = sg.SceneGraphNode("TDGT_404") #Se crea el cubo completo ubicado en la posicion correcta TDGT_404.transform = tr.translate(-0.3,0.3,0) TDGT_404.childs += [cuboRojo, Tap_DGT_404] DGT_404 = sg.SceneGraphNode("DGT_404") #Se crea el cubo completo DGT_404.childs += [TDGT_404] CDGT_404 = cc.Curso('DGT_404',['DGT_304'],-0.3,0.3,0,['DGT_503','DG_701','DG_702']) Tap_DGH_405 = sg.SceneGraphNode("Tap_DGH_405") #Se crea la 'tapa' para el cubo Tap_DGH_405.transform = tr.matmul([tr.translate(0,0,0.252),tr.uniformScale(0.5)]) Tap_DGH_405.childs += [DGH405] TDGH_405 = sg.SceneGraphNode("TDGH_405") #Se crea el cubo completo ubicado en la posicion correcta TDGH_405.transform = tr.translate(0.3,0.3,0) TDGH_405.childs += [cuboRojo, Tap_DGH_405] DGH_405 = sg.SceneGraphNode("DGH_405") #Se crea el cubo completo DGH_405.childs += [TDGH_405] CDGH_405 = cc.Curso('DGH_405',[],0.3,0.3,0,['DGH_504','DG_701','DG_702']) Tap_DGH_406 = sg.SceneGraphNode("Tap_DGH_406") #Se crea la 'tapa' para el cubo Tap_DGH_406.transform = tr.matmul([tr.translate(0,0,0.252),tr.uniformScale(0.5)]) Tap_DGH_406.childs += [DGH406] TDGH_406 = sg.SceneGraphNode("TDGH_406") #Se crea el cubo completo ubicado en la posicion correcta TDGH_406.transform = tr.translate(0.9,0.3,0) TDGH_406.childs += [cuboRojo, Tap_DGH_406] DGH_406 = sg.SceneGraphNode("DGH_406") #Se crea el cubo completo DGH_406.childs += [TDGH_406] CDGH_406 = cc.Curso('DGH_406',['DGH_306'],0.9,0.3,0,['DGP_501','DG_701','DG_702']) Tap_DGH_407 = sg.SceneGraphNode("Tap_DGH_407") #Se crea la 'tapa' para el cubo Tap_DGH_407.transform = tr.matmul([tr.translate(0,0,0.252),tr.uniformScale(0.5)]) Tap_DGH_407.childs += [DGH407] TDGH_407 = sg.SceneGraphNode("TDGH_407") #Se crea el cubo completo ubicado en la posicion correcta TDGH_407.transform = tr.translate(1.5,0.3,0) TDGH_407.childs += [cuboRojo, Tap_DGH_407] DGH_407 = sg.SceneGraphNode("DGH_407") #Se crea el cubo completo DGH_407.childs += [TDGH_407] CDGH_407 = cc.Curso('DGH_407',['DGH_307'],1.5,0.3,0,['DGP_501','DGH_506','DG_701','DG_702']) Tap_DE_2 = sg.SceneGraphNode("Tap_DE_2") #Se crea la 'tapa' para el cubo Tap_DE_2.transform = tr.matmul([tr.translate(0,0,0.252),tr.uniformScale(0.5)]) Tap_DE_2.childs += [DE2] TDE_2 = sg.SceneGraphNode("TDE_2") #Se crea el cubo completo ubicado en la posicion correcta TDE_2.transform = tr.translate(2.1,0.3,0) TDE_2.childs += [cuboRojo, Tap_DE_2] DE_2 = sg.SceneGraphNode("DE_2") #Se crea el cubo completo DE_2.childs += [TDE_2] CDE_2 = cc.Curso('DE_2',[],2.1,0.3,0,['DE_4','DG_701','DG_702']) #Septimo Semestre Tap_DGP_501 = sg.SceneGraphNode("Tap_DGP_501") #Se crea la 'tapa' para el cubo Tap_DGP_501.transform = tr.matmul([tr.translate(0,0,0.252),tr.uniformScale(0.5)]) Tap_DGP_501.childs += [DGP501] TDGP_501 = sg.SceneGraphNode("TDGP_501") #Se crea el cubo completo ubicado en la posicion correcta TDGP_501.transform = tr.translate(-2.1,-0.3,0) TDGP_501.childs += [cuboRojo, Tap_DGP_501] DGP_501 = sg.SceneGraphNode("DGP_501") #Se crea el cubo completo DGP_501.childs += [TDGP_501] CDGP_501 = cc.Curso('DGP_501',['DGT_403','DGH_407','DGH_406','DGP_401'],-2.1,-0.3,0,['DGP_601','DG_701','DG_702']) Tap_DGP_502 = sg.SceneGraphNode("Tap_DGP_502") #Se crea la 'tapa' para el cubo Tap_DGP_502.transform = tr.matmul([tr.translate(0,0,0.252),tr.uniformScale(0.5)]) Tap_DGP_502.childs += [DGP502] TDGP_502 = sg.SceneGraphNode("TDGP_502") #Se crea el cubo completo ubicado en la posicion correcta TDGP_502.transform = tr.translate(-1.5,-0.3,0) TDGP_502.childs += [cuboRojo, Tap_DGP_502] DGP_502 = sg.SceneGraphNode("DGP_502") #Se crea el cubo completo DGP_502.childs += [TDGP_502] CDGP_502 = cc.Curso('DGP_502',['DGT_403'],-1.5,-0.3,0,['DGP_602','DG_701','DG_702']) Tap_DGT_503 = sg.SceneGraphNode("Tap_DGT_503") #Se crea la 'tapa' para el cubo Tap_DGT_503.transform = tr.matmul([tr.translate(0,0,0.252),tr.uniformScale(0.5)]) Tap_DGT_503.childs += [DGT503] TDGT_503 = sg.SceneGraphNode("TDGT_503") #Se crea el cubo completo ubicado en la posicion correcta TDGT_503.transform = tr.translate(-0.9,-0.3,0) TDGT_503.childs += [cuboRojo, Tap_DGT_503] DGT_503 = sg.SceneGraphNode("DGT_503") #Se crea el cubo completo DGT_503.childs += [TDGT_503] CDGT_503 = cc.Curso('DGT_503',['DGT_404'],-0.9,-0.3,0,['DGT_603','DG_701','DG_702']) Tap_DGH_504 = sg.SceneGraphNode("Tap_DGH_504") #Se crea la 'tapa' para el cubo Tap_DGH_504.transform = tr.matmul([tr.translate(0,0,0.252),tr.uniformScale(0.5)]) Tap_DGH_504.childs += [DGH504] TDGH_504 = sg.SceneGraphNode("TDGH_504") #Se crea el cubo completo ubicado en la posicion correcta TDGH_504.transform = tr.translate(-0.3,-0.3,0) TDGH_504.childs += [cuboRojo, Tap_DGH_504] DGH_504 = sg.SceneGraphNode("DGH_504") #Se crea el cubo completo DGH_504.childs += [TDGH_504] CDGH_504 = cc.Curso('DGH_504',['DGH_405'],-0.3,-0.3,0,['DGH_604','DG_701','DG_702']) Tap_DGH_505 = sg.SceneGraphNode("Tap_DGH_505") #Se crea la 'tapa' para el cubo Tap_DGH_505.transform = tr.matmul([tr.translate(0,0,0.252),tr.uniformScale(0.5)]) Tap_DGH_505.childs += [DGH505] TDGH_505 = sg.SceneGraphNode("TDGH_505") #Se crea el cubo completo ubicado en la posicion correcta TDGH_505.transform = tr.translate(0.3,-0.3,0) TDGH_505.childs += [cuboRojo, Tap_DGH_505] DGH_505 = sg.SceneGraphNode("DGH_505") #Se crea el cubo completo DGH_505.childs += [TDGH_505] CDGH_505 = cc.Curso('DGH_505',['DGH_305'],0.3,-0.3,0,['DG_701','DG_702']) Tap_DGH_506 = sg.SceneGraphNode("Tap_DGH_506") #Se crea la 'tapa' para el cubo Tap_DGH_506.transform = tr.matmul([tr.translate(0,0,0.252),tr.uniformScale(0.5)]) Tap_DGH_506.childs += [DGH506] TDGH_506 = sg.SceneGraphNode("TDGH_506") #Se crea el cubo completo ubicado en la posicion correcta TDGH_506.transform = tr.translate(0.9,-0.3,0) TDGH_506.childs += [cuboRojo, Tap_DGH_506] DGH_506 = sg.SceneGraphNode("DGH_506") #Se crea el cubo completo DGH_506.childs += [TDGH_506] CDGH_506 = cc.Curso('DGH_506',['DGH_407'],0.9,-0.3,0,['DGP_601','DGH_606','DG_701','DG_702']) Tap_DGH_507 = sg.SceneGraphNode("Tap_DGH_507") #Se crea la 'tapa' para el cubo Tap_DGH_507.transform = tr.matmul([tr.translate(0,0,0.252),tr.uniformScale(0.5)]) Tap_DGH_507.childs += [DGH507] TDGH_507 = sg.SceneGraphNode("TDGH_507") #Se crea el cubo completo ubicado en la posicion correcta TDGH_507.transform = tr.translate(1.5,-0.3,0) TDGH_507.childs += [cuboRojo, Tap_DGH_507] DGH_507 = sg.SceneGraphNode("DGH_507") #Se crea el cubo completo DGH_507.childs += [TDGH_507] CDGH_507 = cc.Curso('DGH_507',['DGT_402'],1.5,-0.3,0,['DG_701','DG_702']) Tap_DE_3 = sg.SceneGraphNode("Tap_DE_3") #Se crea la 'tapa' para el cubo Tap_DE_3.transform = tr.matmul([tr.translate(0,0,0.252),tr.uniformScale(0.5)]) Tap_DE_3.childs += [DE3] TDE_3 = sg.SceneGraphNode("TDE_3") #Se crea el cubo completo ubicado en la posicion correcta TDE_3.transform = tr.translate(2.1,-0.3,0) TDE_3.childs += [cuboRojo, Tap_DE_3] DE_3 = sg.SceneGraphNode("DE_3") #Se crea el cubo completo DE_3.childs += [TDE_3] CDE_3 = cc.Curso('DE_3',['DE_1'],2.1,-0.3,0,['DG_701','DG_702']) #Octavo Semestre Tap_DGP_601 = sg.SceneGraphNode("Tap_DGP_601") #Se crea la 'tapa' para el cubo Tap_DGP_601.transform = tr.matmul([tr.translate(0,0,0.252),tr.uniformScale(0.5)]) Tap_DGP_601.childs += [DGP601] TDGP_601 = sg.SceneGraphNode("TDGP_601") #Se crea el cubo completo ubicado en la posicion correcta TDGP_601.transform = tr.translate(-2.1,-0.9,0) TDGP_601.childs += [cuboRojo, Tap_DGP_601] DGP_601 = sg.SceneGraphNode("DGP_601") #Se crea el cubo completo DGP_601.childs += [TDGP_601] CDGP_601 = cc.Curso('DGP_601',['DGH_506','DGP_501'],-2.1,-0.9,0,['DG_701','DG_702']) Tap_DGP_602 = sg.SceneGraphNode("Tap_DGP_602") #Se crea la 'tapa' para el cubo Tap_DGP_602.transform = tr.matmul([tr.translate(0,0,0.252),tr.uniformScale(0.5)]) Tap_DGP_602.childs += [DGP602] TDGP_602 = sg.SceneGraphNode("TDGP_602") #Se crea el cubo completo ubicado en la posicion correcta TDGP_602.transform = tr.translate(-1.5,-0.9,0) TDGP_602.childs += [cuboRojo, Tap_DGP_602] DGP_602 = sg.SceneGraphNode("DGP_602") #Se crea el cubo completo DGP_602.childs += [TDGP_602] CDGP_602 = cc.Curso('DGP_602',['DGP_502'],-1.5,-0.9,0,['DG_701','DG_702']) Tap_DGT_603 = sg.SceneGraphNode("Tap_DGT_603") #Se crea la 'tapa' para el cubo Tap_DGT_603.transform = tr.matmul([tr.translate(0,0,0.252),tr.uniformScale(0.5)]) Tap_DGT_603.childs += [DGT603] TDGT_603 = sg.SceneGraphNode("TDGT_603") #Se crea el cubo completo ubicado en la posicion correcta TDGT_603.transform = tr.translate(-0.9,-0.9,0) TDGT_603.childs += [cuboRojo, Tap_DGT_603] DGT_603 = sg.SceneGraphNode("DGT_603") #Se crea el cubo completo DGT_603.childs += [TDGT_603] CDGT_603 = cc.Curso('DGT_603',['DGT_503'],-0.9,-0.9,0,['DG_701','DG_702']) Tap_DGH_604 = sg.SceneGraphNode("Tap_DGH_604") #Se crea la 'tapa' para el cubo Tap_DGH_604.transform = tr.matmul([tr.translate(0,0,0.252),tr.uniformScale(0.5)]) Tap_DGH_604.childs += [DGH604] TDGH_604 = sg.SceneGraphNode("TDGH_604") #Se crea el cubo completo ubicado en la posicion correcta TDGH_604.transform = tr.translate(-0.3,-0.9,0) TDGH_604.childs += [cuboRojo, Tap_DGH_604] DGH_604 = sg.SceneGraphNode("DGH_604") #Se crea el cubo completo DGH_604.childs += [TDGH_604] CDGH_604 = cc.Curso('DGH_604',['DGH_504'],-0.3,-0.9,0,['DG_701','DG_702']) Tap_DGH_605 = sg.SceneGraphNode("Tap_DGH_605") #Se crea la 'tapa' para el cubo Tap_DGH_605.transform = tr.matmul([tr.translate(0,0,0.252),tr.uniformScale(0.5)]) Tap_DGH_605.childs += [DGH605] TDGH_605 = sg.SceneGraphNode("TDGH_605") #Se crea el cubo completo ubicado en la posicion correcta TDGH_605.transform = tr.translate(0.3,-0.9,0) TDGH_605.childs += [cuboRojo, Tap_DGH_605] DGH_605 = sg.SceneGraphNode("DGH_605") #Se crea el cubo completo DGH_605.childs += [TDGH_605] CDGH_605 = cc.Curso('DGH_605',[],0.3,-0.9,0,['DG_701','DG_702']) Tap_DGH_606 = sg.SceneGraphNode("Tap_DGH_606") #Se crea la 'tapa' para el cubo Tap_DGH_606.transform = tr.matmul([tr.translate(0,0,0.252),tr.uniformScale(0.5)]) Tap_DGH_606.childs += [DGH606] TDGH_606 = sg.SceneGraphNode("TDGH_606") #Se crea el cubo completo ubicado en la posicion correcta TDGH_606.transform = tr.translate(0.9,-0.9,0) TDGH_606.childs += [cuboRojo, Tap_DGH_606] DGH_606 = sg.SceneGraphNode("DGH_606") #Se crea el cubo completo DGH_606.childs += [TDGH_606] CDGH_606 = cc.Curso('DGH_606',['DGH_506'],0.9,-0.9,0,['DG_701','DG_702']) Tap_DE_4 = sg.SceneGraphNode("Tap_DE_4") #Se crea la 'tapa' para el cubo Tap_DE_4.transform = tr.matmul([tr.translate(0,0,0.252),tr.uniformScale(0.5)]) Tap_DE_4.childs += [DE4] TDE_4 = sg.SceneGraphNode("TDE_4") #Se crea el cubo completo ubicado en la posicion correcta TDE_4.transform = tr.translate(1.5,-0.9,0) TDE_4.childs += [cuboRojo, Tap_DE_4] DE_4 = sg.SceneGraphNode("DE_4") #Se crea el cubo completo DE_4.childs += [TDE_4] CDE_4 = cc.Curso('DE_4',['DE_1','DE_2'],1.5,-0.9,0,['DG_701','DG_702']) Licenciatura_P_Prof = ['DP_101','DP_102','DP_103','DT_104','DT_105','DH_106','DH_107','DH_108', 'DGP_201','DGP_202','DGP_203','DGT_204','DGT_205','DGH_206','DGH_207','DGH_208', 'DGP_301','DGT_302','DGT_303','DGT_304','DGH_305','DGH_306','DGH_307','DE_1', 'DGP_401','DGT_402','DGT_403','DGT_404','DGH_405','DGH_406','DGH_407','DE_2', 'DGP_501','DGP_502','DGT_503','DGH_504','DGH_505','DGH_506','DGH_507','DE_3', 'DGP_601','DGP_602','DGT_603','DGH_604','DGH_605','DGH_606','DE_4'] #Noveno semestre Tap_DG_701 = sg.SceneGraphNode("Tap_DG_701") #Se crea la 'tapa' para el cubo Tap_DG_701.transform = tr.matmul([tr.translate(0,0,0.252),tr.uniformScale(0.5)]) Tap_DG_701.childs += [DG701] TDG_701 = sg.SceneGraphNode("TDG_701") #Se crea el cubo completo ubicado en la posicion correcta TDG_701.transform = tr.translate(-2.1,-1.5,0) TDG_701.childs += [cuboRojo, Tap_DG_701] DG_701 = sg.SceneGraphNode("DG_701") #Se crea el cubo completo DG_701.childs += [TDG_701] CDG_701 = cc.Curso('DG_701',Licenciatura_P_Prof,-2.1,-1.5,0,['DG_801']) Tap_DG_702 = sg.SceneGraphNode("Tap_DG_702") #Se crea la 'tapa' para el cubo Tap_DG_702.transform = tr.matmul([tr.translate(0,0,0.252),tr.uniformScale(0.5)]) Tap_DG_702.childs += [DG702] TDG_702 = sg.SceneGraphNode("TDG_702") #Se crea el cubo completo ubicado en la posicion correcta TDG_702.transform = tr.translate(-1.5,-1.5,0) TDG_702.childs += [cuboRojo, Tap_DG_702] DG_702 = sg.SceneGraphNode("DG_702") #Se crea el cubo completo DG_702.childs += [TDG_702] CDG_702 = cc.Curso('DG_702',Licenciatura_P_Prof,-1.5,-1.5,0,['DG_801']) #Decimo semestre Tap_DG_801 = sg.SceneGraphNode("Tap_DG_801") #Se crea la 'tapa' para el cubo Tap_DG_801.transform = tr.matmul([tr.translate(0,0,0.252),tr.uniformScale(0.5)]) Tap_DG_801.childs += [DG801] TDG_801 = sg.SceneGraphNode("TDG_801") #Se crea el cubo completo ubicado en la posicion correcta TDG_801.transform = tr.translate(-2.1,-2.1,0) TDG_801.childs += [cuboRojo, Tap_DG_801] DG_801 = sg.SceneGraphNode("DG_801") #Se crea el cubo completo DG_801.childs += [TDG_801] CDG_801 = cc.Curso('DG_801',['DG_701','DG_702'],-2.1,-2.1,0) #Aqui se comienzan a crear los cursos en un mismo plano semestre1 = sg.SceneGraphNode("semestre1") semestre1.childs += [DP_101,DP_102,DP_103,DT_104,DT_105,DH_106,DH_107,DH_108] semestre2 = sg.SceneGraphNode("semestre2") semestre2.childs += [DGP_201,DGP_202,DGP_203,DGT_204,DGT_205,DGH_206,DGH_207,DGH_208] semestre3 = sg.SceneGraphNode("semestre3") semestre3.childs += [DGP_301,DGT_302,DGT_303,DGT_304,DGH_305,DGH_306,DGH_307,DE_1] semestre4 = sg.SceneGraphNode("semestre4") semestre4.childs += [DGP_401,DGT_402,DGT_403,DGT_404,DGH_405,DGH_406,DGH_407,DE_2] semestre5 = sg.SceneGraphNode("semestre5") semestre5.childs += [DGP_501,DGP_502,DGT_503,DGH_504,DGH_505,DGH_506,DGH_507,DE_3] semestre6 = sg.SceneGraphNode("semestre6") semestre6.childs += [DGP_601,DGP_602,DGT_603,DGH_604,DGH_605,DGH_606,DE_4] semestre7 = sg.SceneGraphNode("semestre7") semestre7.childs += [DG_701,DG_702] semestre8 = sg.SceneGraphNode("semestre8") semestre8.childs += [DG_801] Csemestre1 = [CDP_101,CDP_102,CDP_103,CDT_104,CDT_105,CDH_106,CDH_107,CDH_108] Csemestre2 = [CDGP_201,CDGP_202,CDGP_203,CDGT_204,CDGT_205,CDGH_206,CDGH_207,CDGH_208] Csemestre3 = [CDGP_301,CDGT_302,CDGT_303,CDGT_304,CDGH_305,CDGH_306,CDGH_307,CDE_1] Csemestre4 = [CDGP_401,CDGT_402,CDGT_403,CDGT_404,CDGH_405,CDGH_406,CDGH_407,CDE_2] Csemestre5 = [CDGP_501,CDGP_502,CDGT_503,CDGH_504,CDGH_505,CDGH_506,CDGH_507,CDE_3] Csemestre6 = [CDGP_601,CDGP_602,CDGT_603,CDGH_604,CDGH_605,CDGH_606,CDE_4] Csemestre7 = [CDG_701,CDG_702] Csemestre8 = [CDG_801] Cmalla = [Csemestre1,Csemestre2,Csemestre3,Csemestre4,Csemestre5,Csemestre6,Csemestre7,Csemestre8] malla = sg.SceneGraphNode("malla") malla.childs = [semestre1,semestre2,semestre3,semestre4,semestre5,semestre6,semestre7,semestre8] return malla , Cmalla
star3 = createStar(); star13 = createStar() star4 = createStar(); star14 = createStar() star5 = createStar(); star15 = createStar() star6 = createStar(); star16 = createStar() star7 = createStar(); star17 = createStar() star8 = createStar(); star18 = createStar() star9 = createStar(); star19 = createStar() star10 = createStar(); star20 = createStar() redPlanets = [redPlanet1, redPlanet2, redPlanet3, redPlanet4, redPlanet5, redPlanet6] greenPlanets = [greenPlanet1, greenPlanet2, greenPlanet3, greenPlanet4, greenPlanet5, greenPlanet6] bluePlanets = [bluePlanet1, bluePlanet2, bluePlanet3, bluePlanet4, bluePlanet5, bluePlanet6] stars = [star1, star2, star3, star4, star5, star6, star7, star8, star9, star10, star11, star12, star13, star14, star15, star16, star17, star18, star19, star20] gpuGameOver = es.toGPUShape(bs.createTextureQuad("gameover.png"), GL_REPEAT, GL_NEAREST) gpuGameOverTransform = tr.matmul([tr.uniformScale(1.9)]) # Our shapes here are always fully painted glPolygonMode(GL_FRONT_AND_BACK, GL_FILL) t0 = glfw.get_time() # Number of times the user ship is hit by the enemy shots tirosAlUsuario = 0 # Number of times the enemy ship is hit by the shots of the user ship tirosAlEnemigo = 0 while not glfw.window_should_close(window): # Getting the time difference from the previous iteration t1 = glfw.get_time()
def __init__(self): pasto = es.toGPUShape(bs.createTextureQuad("Pasto.png", 1, 1), GL_REPEAT, GL_LINEAR) pastoTransform= tr.uniformScale(2) self.model = pasto self.tra = pastoTransform self.pos = 0.1
def Amy_jump(estructura): if __name__ == "__main__": # Initialize glfw if not glfw.init(): sys.exit() width = 700 height = 700 window = glfw.create_window(width, height, "Amy Jump", None, None) if not window: glfw.terminate() sys.exit() glfw.make_context_current(window) # Connecting the callback function 'on_key' to handle keyboard events glfw.set_key_callback(window, on_key) # Defining shader programs pipeline = ls.SimpleGouraudShaderProgram() texture_pipeline = es.SimpleTextureModelViewProjectionShaderProgram() color_pipeline = es.SimpleModelViewProjectionShaderProgram() tex_pipeline = es.SimpleTextureTransformShaderProgram() # Telling OpenGL to use our shader program glUseProgram(pipeline.shaderProgram) # Setting up the clear screen color glClearColor(0.85, 0.85, 0.85, 1.0) # As we work in 3D, we need to check which part is in front, # and which one is at the back glEnable(GL_DEPTH_TEST) glEnable(GL_BLEND) glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) # Creamos los objetos # Amy gpuAmy = es.toGPUShape(shape=readOBJ('amy.obj', (1, 0, 0.5))) # Anillo (trofeo) gpuAnillo = es.toGPUShape(shape=readOBJ('ring.obj', (0.9, 0.9, 0))) # Fondo fondo = Fondo() #Piso piso = bs.createTextureCube('piso.jpg') gpupiso = es.toGPUShape(piso, GL_REPEAT, GL_LINEAR) piso_transform = tr.matmul( [tr.uniformScale(24), tr.translate(0, 0, -0.53)]) # Pantalla de inicio amyi = es.toGPUShape(bs.createTextureQuad("amy2.png", 1, 1), GL_REPEAT, GL_LINEAR) # Pantala de perdida eggman = es.toGPUShape(bs.createTextureQuad("eggman.png", 1, 1), GL_REPEAT, GL_LINEAR) # Pantalla de ganador amyf = es.toGPUShape(bs.createTextureQuad("am.png", 1, 1), GL_REPEAT, GL_LINEAR) # Barras barras = CreateBarras() barras.create(estructura) #Revisamos el tiempo t0 = glfw.get_time() # Posiciones de Amy posX = 0 posY = 0 posZ = 0.5 #Cuenta los fondo que ya se crearon count = 1 # Indica hasta que altura se debe llegar al saltar alt = 0 # Dice si se puede saltar o no salto = True #Indica cuando se "pierde" por saltar mal perder = False #Indica cuando se pierde por una flecha perder2 = False # Dice si se debe mandar una flecha de ataque arrow = True #Se crea la flecha con las posiciones hacia Amy flechas = Flecha(posX, posY, posZ) #Tamaño inicial de la imagen de partida, de perdida y de ganador ag = 2 eg = 0 af = 0 # rotaciones de Amy rotz = np.pi rotx = np.pi / 2 roty = 0 #Indica si ya estuvo en una barra bt = False #Rotaciones y posiciones del aro ra = 0 x = 0 y = 0 #Indica si gana o pierde ganar = False while not glfw.window_should_close(window): # Using GLFW to check for input events glfw.poll_events() # Getting the time difference from the previous iteration t1 = glfw.get_time() dt = t1 - t0 t0 = t1 #Se define la vista "fija" del juego view = tr.lookAt(np.array([12, -5, 8 + (posZ - 0.5)]), np.array([posX * 0.4, posY * 0.4, posZ]), np.array([0, 0, 1])) #Cambia la vista mientras se mantengan apretadas las teclas if (glfw.get_key(window, glfw.KEY_B) == glfw.PRESS): view = tr.lookAt(np.array([0, 1, 17.5 + (posZ)]), np.array([0, 0, 0]), np.array([0, 0, 1])) if (glfw.get_key(window, glfw.KEY_N) == glfw.PRESS): view = tr.lookAt(np.array([-12, -5, 7.5 + posZ]), np.array([posX, posY, posZ]), np.array([0, 0, 1])) if (glfw.get_key(window, glfw.KEY_M) == glfw.PRESS): view = tr.lookAt(np.array([0, 10, -0.5 + posZ]), np.array([posX, posY, posZ]), np.array([0, 0, 1])) # Setting up the projection transform projection = tr.perspective(60, float(width) / float(height), 0.1, 100) # Clearing the screen in both, color and depth glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT) #Dibujamos el fondo fondo.Draw(texture_pipeline, projection, view) # Revisamos si se debe crear otro fondo if posZ > 13 * count: fondoazul = FondoAzul(count, fondo) count += 1 #Dibujamos el piso glUseProgram(texture_pipeline.shaderProgram) glUniformMatrix4fv( glGetUniformLocation(texture_pipeline.shaderProgram, "model"), 1, GL_TRUE, piso_transform) glUniformMatrix4fv( glGetUniformLocation(texture_pipeline.shaderProgram, "projection"), 1, GL_TRUE, projection) glUniformMatrix4fv( glGetUniformLocation(texture_pipeline.shaderProgram, "view"), 1, GL_TRUE, view) texture_pipeline.drawShape(gpupiso) # Luz glUseProgram(pipeline.shaderProgram) glUniform3f(glGetUniformLocation(pipeline.shaderProgram, "La"), 1.0, 1.0, 1.0) glUniform3f(glGetUniformLocation(pipeline.shaderProgram, "Ld"), 1.0, 1.0, 1.0) glUniform3f(glGetUniformLocation(pipeline.shaderProgram, "Ls"), 1.0, 1.0, 1.0) glUniform3f(glGetUniformLocation(pipeline.shaderProgram, "Ka"), 0.3, 0.3, 0.3) glUniform3f(glGetUniformLocation(pipeline.shaderProgram, "Kd"), 0.9, 0.9, 0.9) glUniform3f(glGetUniformLocation(pipeline.shaderProgram, "Ks"), 0.2, 0.2, 0.2) glUniform3f( glGetUniformLocation(pipeline.shaderProgram, "lightPosition"), 0, 0, posZ + 5) glUniform3f( glGetUniformLocation(pipeline.shaderProgram, "viewPosition"), 0, 0, posZ + 5) glUniform1ui( glGetUniformLocation(pipeline.shaderProgram, "shininess"), 1000) glUniform1f( glGetUniformLocation(pipeline.shaderProgram, "constantAttenuation"), 0.01) glUniform1f( glGetUniformLocation(pipeline.shaderProgram, "linearAttenuation"), 0.1) glUniform1f( glGetUniformLocation(pipeline.shaderProgram, "quadraticAttenuation"), 0.01) #Dibujamos a Amy glUniformMatrix4fv( glGetUniformLocation(pipeline.shaderProgram, "projection"), 1, GL_TRUE, projection) glUniformMatrix4fv( glGetUniformLocation(pipeline.shaderProgram, "view"), 1, GL_TRUE, view) glUniformMatrix4fv( glGetUniformLocation(pipeline.shaderProgram, "model"), 1, GL_TRUE, tr.matmul([ tr.translate(posX, posY, posZ), tr.rotationZ(rotz), tr.rotationX(rotx), tr.rotationY(roty), tr.uniformScale(0.4) ])) pipeline.drawShape(gpuAmy) #Dibujamos el anillo a la altura de la ultima barra glUniformMatrix4fv( glGetUniformLocation(pipeline.shaderProgram, "model"), 1, GL_TRUE, tr.matmul([ tr.translate(x, y, barras.altura * 2), tr.rotationZ(ra), tr.uniformScale(0.5) ])) pipeline.drawShape(gpuAnillo) # Dibujamos la pantalla inicial glUseProgram(tex_pipeline.shaderProgram) glUniformMatrix4fv( glGetUniformLocation(tex_pipeline.shaderProgram, "transform"), 1, GL_TRUE, tr.matmul([tr.translate(0, 0, 0), tr.uniformScale(ag)])) tex_pipeline.drawShape(amyi) # Dibujamos la pantalla de perdida glUniformMatrix4fv( glGetUniformLocation(tex_pipeline.shaderProgram, "transform"), 1, GL_TRUE, tr.matmul([tr.translate(0, 0, 0), tr.uniformScale(eg)])) tex_pipeline.drawShape(eggman) # Dibujamos la pantalla de ganador glUniformMatrix4fv( glGetUniformLocation(tex_pipeline.shaderProgram, "transform"), 1, GL_TRUE, tr.matmul([tr.translate(0, 0, 0), tr.uniformScale(af)])) tex_pipeline.drawShape(amyf) # Hace una copia de la lista de barras b = barras.barras #Indica que hay gravedad por lo cual amy va a caer mientras no este en una plataforma grav = True #Cambia el angulo de de rotación del aro ra -= 2 * dt #Revisa que la posición de las barras calza con Amy for i in range(len(b)): if posX <= 2 * b[i].posx + 1 and posX >= 2 * b[ i].posx - 1 and posY <= 2 * b[ i].posy + 1 and posY >= 2 * b[ i].posy - 1 and posZ <= b[ i].posz * 0.3 + 1.4 and posZ >= b[ i].posz * 0.3 + 1.25: if b[i].real == False: #Revisa si la barra es real, de serlo no la dibuja y no apaga la gravedad b[i].dibujo = False else: grav = False #si no, apaga la gravedad bt = True #indica que ya se subio una barra # Implementa la gravedad if posZ > 0.6 and grav == True: posZ -= 3 * dt #Mueve a Amy dependiendo de la tecla que se precione if (glfw.get_key(window, glfw.KEY_A) == glfw.PRESS): if posX > -6: posX -= 5 * dt if (glfw.get_key(window, glfw.KEY_D) == glfw.PRESS): if posX < 6: posX += 5 * dt if (glfw.get_key(window, glfw.KEY_W) == glfw.PRESS): if posY < 6: posY += 5 * dt if (glfw.get_key(window, glfw.KEY_S) == glfw.PRESS): if posY > -6: posY -= 5 * dt #Implementa los saltos if (glfw.get_key(window, glfw.KEY_SPACE) == glfw.PRESS): #si se puede saltar if salto == True: salto = False #se bloquea otro salto alt = 2 + posZ #calcula hasta donde debe llegar #si no pierde y no llega al limite de altura if alt >= posZ and perder == False: posZ += 5 * dt #salta #Si esta en una barra y aún no pierde if grav == False and perder2 == False: salto = True #Puede volver a saltar perder = False #aún no pierde #Inidica que perdio if alt < posZ + 0.01: perder = True # Si es que se puede hacer una flecha if arrow == True: ti = t1 #Revisamos el tiempo actual arrow = False #decimos que no se pueden hacer mas flechas flechas = Flecha(posX, posY, posZ) #se indica las posicones de la flecha # Si ya pasa un tiempo especifico if ti + 3 < t1: arrow = True # se puede hacer otra flecha #Revisamos que una flecha toca a Amy if flechas.posx <= posX + 0.1 and flechas.posx >= posX - 0.1 and flechas.posy <= -posY * 0.2 + 0.1 and flechas.posy >= -posY * 0.2 - 0.1 and flechas.posz <= posZ * 0.2 + 0.1 and flechas.posz >= posZ * 0.2 - 0.1: perder2 = True #Pierde #Mueve las flechas a partir de un tiempo en especifico if t1 > 8: flechas.update(4 * dt) flechas.draw(pipeline, projection, view) #Hace el movimiento de la imagen inicial if t1 < 8: if ag > 0: ag -= dt #Si pierde genera la imagen de game over y Amy empieza a rotar if ((posZ >= 0.5 and posZ <= 0.6 and grav and bt) or perder2 or (salto == False and posZ >= 0.5 and posZ <= 0.6)) and ganar == False: if eg < 2: eg += 0.8 * dt rotx -= 2 * dt rotz -= 2 * dt #Indica cuando gana if barras.altura * 2 - posZ <= 0.5 and barras.altura * 2 - posZ >= 0 and grav == False: ganar = True #Mueve el aro a Amy if x < 1.7 * posX: x += 5 * dt elif x >= 1.7 * posX: x -= 5 * dt if y < 1 * posY: y += 5 * dt elif y >= 1 * posY: y -= 5 * dt #Hace el movimiento de la imagen de ganador if af < 2: af += 0.8 * dt #Dibuja las barras barras.draw(color_pipeline, projection, view) # Once the drawing is rendered, buffers are swap so an uncomplete drawing is never seen. glfw.swap_buffers(window) glfw.terminate()
# Connecting the callback function 'on_key' to handle keyboard events glfw.set_key_callback(window, controller.on_key) # Assembling the shader program (pipeline) with both shaders pipeline = es.SimpleTransformShaderProgram() pipeline2 = es.SimpleTextureTransformShaderProgram() # Telling OpenGL to use ou shader program glUseProgram(pipeline.shaderProgram) # Setting up the clear screen color glClearColor(23 / 255, 9 / 255, 54 / 255, 1.0) # Our shapes here are always fully painted glPolygonMode(GL_FRONT_AND_BACK, GL_FILL) gpuShape = es.toGPUShape(bs.createTextureQuad("starry_sky.png", 1, 1), GL_REPEAT, GL_LINEAR) ### Create shapes # gpuStars = es.to_gpu_shape(basic_shapes.creature_texture_quad('/static/starry_sky copy.png'), GL_REPEAT, GL_LINEAL) data = main(*sys.argv[1:]) # argv[0] es el nombre de este archivo systems = [] for system in data: color = system['Color'] radius = system['Radius'] distance = system['Distance'] velocity = system['Velocity'] satellites = system['Satellites'] sun = Cuerpo(color, radius, distance, velocity, satellites) systems.append(sun) controller.set_model(sun)
def __init__(self, texture): self.background = es.toGPUShape(bs.createTextureQuad(texture), GL_REPEAT, GL_LINEAR) self.transbackground = np.matmul(tr2.translate(0, 0.2, 0), tr2.scale(2, 2.5, 1)) self.level = 0 #indica en que nivel esta el monito, parte desde 0: suelo
] greenPlanets = [ greenPlanet1, greenPlanet2, greenPlanet3, greenPlanet4, greenPlanet5, greenPlanet6 ] bluePlanets = [ bluePlanet1, bluePlanet2, bluePlanet3, bluePlanet4, bluePlanet5, bluePlanet6 ] stars = [ star1, star2, star3, star4, star5, star6, star7, star8, star9, star10, star11, star12, star13, star14, star15, star16, star17, star18, star19, star20 ] gpuGameOver = es.toGPUShape(bs.createTextureQuad("gameover.png"), GL_REPEAT, GL_NEAREST) gpuGameOverTransform = tr.matmul([tr.uniformScale(1.9)]) # Our shapes here are always fully painted glPolygonMode(GL_FRONT_AND_BACK, GL_FILL) t0 = glfw.get_time() # Number of times the user ship is hit by the enemy shots tirosAlUsuario = 0 # Number of times the enemy ship is hit by the shots of the user ship tirosAlEnemigo = 0 while not glfw.window_should_close(window): # Getting the time difference from the previous iteration
def draw(p1, p2, p3, p4): # Initialize glfw if not glfw.init(): sys.exit() width = 600 height = 600 window = glfw.create_window(width, height, "Datos acumulados hasta el dia de Hoy", None, None) if not window: glfw.terminate() sys.exit() glfw.make_context_current(window) glfw.set_key_callback(window, on_key) # shaders a usar pipeline = es.SimpleTransformShaderProgram() pipeline_tex = es.SimpleTextureTransformShaderProgram() # matrices transform1 = np.matmul(tr.scale(1, 0.5, 0), tr.translate(0, 1.5, 0)) transform2 = tr.translate(0, -1, 0) # textura de la leyenda imagen = es.toGPUShape(bs.createTextureQuad("img/leyenda.png", 1, 1), GL_REPEAT, GL_NEAREST) # Telling OpenGL to use our shader program glUseProgram(pipeline.shaderProgram) # Setting up the clear screen color glClearColor(1.0, 1.0, 1.0, 1.0) torta = createTortaGraph(p1, p2, p3, p4) while not glfw.window_should_close(window): glfw.poll_events() # Clearing the screen in both, color and depth glClear(GL_COLOR_BUFFER_BIT) # Texturas con fondos transparentes glEnable(GL_BLEND) glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) # Shader de textura y dibujar glUseProgram(pipeline_tex.shaderProgram) glUniformMatrix4fv( glGetUniformLocation(pipeline_tex.shaderProgram, "transform"), 1, GL_TRUE, transform1) pipeline_tex.drawShape(imagen) # Cambiar shaders y dibujar grafico de torta glUseProgram(pipeline.shaderProgram) glUniformMatrix4fv( glGetUniformLocation(pipeline.shaderProgram, "transform"), 1, GL_TRUE, transform2) drawShape(pipeline.shaderProgram, torta) # Once the drawing is rendered, buffers are swap so an uncomplete drawing is never seen. glfw.swap_buffers(window) glfw.terminate()
def createSky(): skyTexture = es.toGPUShape(bs.createTextureQuad("sky.jpg"), GL_REPEAT, GL_NEAREST) sky = sg.SceneGraphNode("sky") sky.transform=tr.uniformScale(2) sky.childs += [skyTexture] return sky
# A simple shader program with position and texture coordinates as inputs. pipeline = es.SimpleTextureTransformShaderProgram() # Telling OpenGL to use our shader program glUseProgram(pipeline.shaderProgram) # Setting up the clear screen color glClearColor(0.25, 0.25, 0.25, 1.0) # Enabling transparencies glEnable(GL_BLEND) glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) # Creating shapes on GPU memory gpuBoo = es.toGPUShape(bs.createTextureQuad("img/boo.png"), GL_REPEAT, GL_NEAREST) gpuQuestionBox = es.toGPUShape( bs.createTextureQuad("img/question_box.png", 10, 1), GL_REPEAT, GL_NEAREST) questionBoxTransform = np.matmul(tr2.translate(0, -0.8, 0), tr2.scale(-2, 0.2, 1)) while not glfw.window_should_close(window): # Using GLFW to check for input events glfw.poll_events() if (controller.fillPolygon): glPolygonMode(GL_FRONT_AND_BACK, GL_FILL) else: