def render(self, visibility): if self.mode != 3: self.renderBackground() self.renderLayers(self.backgroundLayers, visibility) if shaders.enable("stage"): height = 0.0 for i in shaders.var["color"].keys(): shaders.modVar("color",shaders.var["color"][i],0.05,10.0) height += shaders.var["color"][i][3]/3.0 height=height**2 shaders.setVar("height",2*height) shaders.setVar("ambientGlow",height/1.5) shaders.setVar("glowStrength",60+height*80.0) gl.glBegin(gl.GL_TRIANGLE_STRIP) gl.glVertex3f(-8.0, 1.0,7.0) gl.glVertex3f(8.0, 1.0,7.0) gl.glVertex3f(-8.0, 4.0,7.0) gl.glVertex3f(8.0, 4.0,7.0) gl.glEnd() shaders.disable() self.scene.renderGuitar() self.renderLayers(self.foregroundLayers, visibility) self.rockmeter.render(visibility)
def drawSideBars(self, visibility, song, pos): if not song: return if not song.readyToGo: return v = visibility w = self.boardWidth + 0.15 if self.failcount == v: board_col = self.board_col_flash else: board_col = self.board_col gl.glEnable(gl.GL_TEXTURE_2D) if self.instrument.starPowerActive and self.oSideBars and not ( self.guitarSolo or self.soloSideBars): self.oSideBars.texture.bind() elif self.instrument.starPowerActive and self.oSoloSideBars and self.oSidebars and self.guitarSolo: self.oSoloSideBars.texture.bind() elif self.guitarSolo and self.soloSideBars: self.soloSideBars.texture.bind() elif self.sideBars: self.sideBars.texture.bind() if self.isFailing and self.failSideBars and v == self.failcount: self.failSideBars.texture.bind() cmgl.drawArrays(gl.GL_TRIANGLE_STRIP, vertices=self.sidebars_vtx, colors=board_col, texcoords=self.board_tex) gl.glDisable(gl.GL_TEXTURE_2D) if shaders.enable("sololight"): shaders.modVar("color", shaders.var["solocolor"]) shaders.setVar("offset", (-3.5, -w / 2)) cmgl.drawArrays(gl.GL_TRIANGLE_STRIP, vertices=self.soloLightVtx1) shaders.setVar("offset", (-3.5, w / 2)) shaders.setVar("time", shaders.time() + 0.5) cmgl.drawArrays(gl.GL_TRIANGLE_STRIP, vertices=self.soloLightVtx2) shaders.disable()
def drawSideBars(self, visibility, song, pos): if not song: return if not song.readyToGo: return v = visibility w = self.boardWidth + 0.15 if self.failcount == v: board_col = self.board_col_flash else: board_col = self.board_col gl.glEnable(gl.GL_TEXTURE_2D) if self.instrument.starPowerActive and self.oSideBars and not (self.guitarSolo or self.soloSideBars): self.oSideBars.texture.bind() elif self.instrument.starPowerActive and self.oSoloSideBars and self.oSidebars and self.guitarSolo: self.oSoloSideBars.texture.bind() elif self.guitarSolo and self.soloSideBars: self.soloSideBars.texture.bind() elif self.sideBars: self.sideBars.texture.bind() if self.isFailing and self.failSideBars and v == self.failcount: self.failSideBars.texture.bind() cmgl.drawArrays(gl.GL_TRIANGLE_STRIP, vertices=self.sidebars_vtx, colors=board_col, texcoords=self.board_tex) gl.glDisable(gl.GL_TEXTURE_2D) if shaders.enable("sololight"): shaders.modVar("color",shaders.var["solocolor"]) shaders.setVar("offset",(-3.5,-w/2)) cmgl.drawArrays(gl.GL_TRIANGLE_STRIP, vertices=self.soloLightVtx1) shaders.setVar("offset",(-3.5,w/2)) shaders.setVar("time",shaders.time()+0.5) cmgl.drawArrays(gl.GL_TRIANGLE_STRIP, vertices=self.soloLightVtx2) shaders.disable()
def renderNote(self, length, sustain, color, tailOnly = False, isTappable = False, fret = 0, spNote = False, isOpen = False, spAct = False): if tailOnly: return if self.twoDnote == True: tailOnly = True y = 0 if spNote: y += 1 elif self.starPowerActive: y += 2 if isOpen: vtx = self.openVtx if self.noteSpin: texCoord = self.animatedOpenTexCoord[self.noteSpinFrameIndex] if spNote == True: noteImage = self.noteOpenAnimatedPower elif self.starPowerActive == True: #death_au: drum sp active notes. noteImage = self.noteOpenAnimatedPowerActive else: noteImage = self.noteOpenAnimated if not noteImage: noteImage = self.noteButtons texCoord = self.openTexCoord[y] else: if not noteImage: noteImage = self.noteButtons texCoord = self.noteTexCoord[y] else: fret -= 1 vtx = self.noteVtx if self.noteSpin: texCoord = self.animatedNoteTexCoord[self.noteSpinFrameIndex][fret] if spNote: noteImage = self.noteAnimatedPower elif self.starPowerActive: noteImage = self.noteAnimatedPowerActive else: noteImage = self.noteAnimatedNormal if not noteImage: noteImage = self.noteButtons texCoord = self.noteTexCoord[y][fret] else: noteImage = self.noteButtons texCoord = self.noteTexCoord[y][fret] draw3Dtex(noteImage, vertex = vtx, texcoord = texCoord, scale = (1,1,1), rot = (self.camAngle,1,0,0), multiples = False, color = color) else: #3d Notes shaders.setVar("Material",color,"notes") self.notepos = self.engine.theme.drumnotepos self.noterot = self.engine.theme.drumnoterot if fret == 0: fret = 4 #fret 4 is angled, get fret 2 :) #fret = 2 #compensating for this in drum. elif fret == 4: fret = 0 if isOpen and self.openMesh is not None: meshObj = self.openMesh elif spNote and self.starMesh is not None: meshObj = self.starMesh else: meshObj = self.noteMesh gl.glPushMatrix() gl.glEnable(gl.GL_DEPTH_TEST) gl.glDepthMask(1) gl.glShadeModel(gl.GL_SMOOTH) if not isOpen: if spNote and self.threeDspin: gl.glRotate(90 + self.time/3, 0, 1, 0) elif not spNote and self.noterotate: gl.glRotatef(90, 0, 1, 0) gl.glRotatef(-90, 1, 0, 0) if fret >= 0 and fret <= 4: gl.glRotate(self.noterot[fret], 0, 0, 1) gl.glTranslatef(0, self.notepos[fret], 0) texture = None if self.notetex: if isOpen: if self.opentexture_star: texture = self.opentexture_star elif self.opentexture_stara and self.starPowerActive: texture = self.opentexture_stara elif self.opentexture: texture = self.opentexture elif self.startex and spNote: texture = getattr(self,"startex"+chr(97+fret)) elif self.spActTex and spAct: texture = self.spActTex elif self.staratex and self.starPowerActive: texture = getattr(self,"staratex"+chr(97+fret)) else: texture = getattr(self,"notetex"+chr(97+fret)) self.render3DNote(texture, meshObj, color, isTappable) gl.glDepthMask(0) gl.glPopMatrix() gl.glDisable(gl.GL_DEPTH_TEST)
def renderNeck(self, visibility, song, pos): if not song: return if not song.readyToGo: return v = visibility offset = (pos - self.lastBpmChange) / self.currentPeriod + self.baseBeat #myfingershurt: every theme can have oNeck: if self.guitarSolo and self.soloNeck and self.guitarSoloNeckMode == 1: neck = self.soloNeck elif self.scoreMultiplier > 4 and self.bassGrooveNeck and self.bassGrooveNeckMode == 1: neck = self.bassGrooveNeck elif self.fourxNeckMode == 1 and self.fourMultiNeck and self.scoreMultiplier == 4: neck = self.fourMultiNeck elif self.instrument.starPowerActive and not (self.spcount2 != 0 and self.spcount < 1.2) and self.oNeck and self.scoreMultiplier <= 4 and not self.ovrneckoverlay: neck = self.oNeck else: neck = self.neckDrawing self.renderNeckMethod(v*self.neckAlpha[1], offset, neck) if self.guitarSolo and self.soloNeck and self.guitarSoloNeckMode == 2: #static overlay self.renderNeckMethod(v*self.neckAlpha[2], 0, self.soloNeck) if self.bgcount > 0 and self.bassGrooveNeck and self.bassGrooveNeckMode == 2: #static bass groove overlay self.renderNeckMethod(v*self.bgcount*self.neckAlpha[3], 0, self.bassGrooveNeck) if self.fourXcount > 0 and self.fourMultiNeck and self.fourxNeckMode == 2: #4x multi overlay neck self.renderNeckMethod(v*self.fourXcount*self.neckAlpha[6], offset, self.fourMultiNeck) if self.spcount2 != 0 and self.spcount < 1.2 and self.oNeck: #static overlay if self.oNeckovr and (self.scoreMultiplier > 4 or self.guitarSolo or self.ovrneckoverlay): neck = self.oNeckovr alpha = False else: neck = self.oNeck alpha = True self.renderNeckMethod(v*self.spcount*self.neckAlpha[4], offset, neck, alpha) if self.instrument.starPowerActive and not (self.spcount2 != 0 and self.spcount < 1.2) and self.oNeck and (self.scoreMultiplier > 4 or self.guitarSolo or self.ovrneckoverlay): #static overlay if self.oNeckovr: neck = self.oNeckovr alpha = False else: neck = self.oNeck alpha = True self.renderNeckMethod(v*self.neckAlpha[4], offset, neck, alpha) if shaders.enabled: shaders.globals["basspos"] = shaders.var["fret"][self.player][0] shaders.globals["notepos"] = shaders.var["fret"][self.player][1:] shaders.globals["bpm"] = self.instrument.currentBpm shaders.globals["songpos"] = pos shaders.globals["spEnabled"] = self.instrument.starPowerActive shaders.globals["isFailing"] = self.isFailing shaders.globals["isMultChanged"] = (shaders.var["scoreMult"][self.player] != self.scoreMultiplier) if shaders.globals["isMultChanged"]: shaders.var["multChangePos"][self.player] = pos shaders.globals["scoreMult"] = self.scoreMultiplier shaders.var["scoreMult"][self.player] = self.scoreMultiplier shaders.globals["isDrum"] = self.isDrum shaders.globals["soloActive"] = self.guitarSolo posx = shaders.time() neckcol = (0,0,0) notecolors = list(self.engine.theme.noteColors) if self.isDrum: notecolors[4] = notecolors[0] notecolors[0] = self.engine.theme.noteColors[5] for i in range(5): blend = max(shaders.var["fret"][self.player][i] - posx + 1.5,0.01) neckcol = mixColors(neckcol, notecolors[i], blend) shaders.var["color"][self.player]=neckcol if shaders.enable("neck"): shaders.setVar("fretcol",neckcol) shaders.update() cmgl.drawArrays(gl.GL_TRIANGLE_STRIP, vertices=self.shader_neck_vtx) shaders.disable() else: if self.isFailing: self.renderNeckMethod(self.failcount, 0, self.failNeck) if (self.guitarSolo or self.instrument.starPowerActive) and self.theme == 1: shaders.var["solocolor"]=self.shaderSolocolor else: shaders.var["solocolor"]=(0.0,)*4
def renderNote(self, length, sustain, color, tailOnly=False, isTappable=False, fret=0, spNote=False, isOpen=False, spAct=False): if tailOnly: return if self.twoDnote == True: tailOnly = True y = 0 if spNote: y += 1 elif self.starPowerActive: y += 2 if isOpen: vtx = self.openVtx if self.noteSpin: texCoord = self.animatedOpenTexCoord[ self.noteSpinFrameIndex] if spNote == True: noteImage = self.noteOpenAnimatedPower elif self.starPowerActive == True: #death_au: drum sp active notes. noteImage = self.noteOpenAnimatedPowerActive else: noteImage = self.noteOpenAnimated if not noteImage: noteImage = self.noteButtons texCoord = self.openTexCoord[y] else: noteImage = self.noteButtons texCoord = self.openTexCoord[y] else: fret -= 1 vtx = self.noteVtx if self.noteSpin: texCoord = self.animatedNoteTexCoord[ self.noteSpinFrameIndex][fret] if spNote: noteImage = self.noteAnimatedPower elif self.starPowerActive: noteImage = self.noteAnimatedPowerActive else: noteImage = self.noteAnimatedNormal if not noteImage: noteImage = self.noteButtons texCoord = self.noteTexCoord[y][fret] else: noteImage = self.noteButtons texCoord = self.noteTexCoord[y][fret] draw3Dtex(noteImage, vertex=vtx, texcoord=texCoord, scale=(1, 1, 1), rot=(self.camAngle, 1, 0, 0), multiples=False, color=color) else: #3d Notes shaders.setVar("Material", color, "notes") self.notepos = self.engine.theme.drumnotepos self.noterot = self.engine.theme.drumnoterot if fret == 0: fret = 4 #fret 4 is angled, get fret 2 :) #fret = 2 #compensating for this in drum. elif fret == 4: fret = 0 if isOpen and self.openMesh is not None: meshObj = self.openMesh elif spNote and self.starMesh is not None: meshObj = self.starMesh else: meshObj = self.noteMesh gl.glPushMatrix() gl.glEnable(gl.GL_DEPTH_TEST) gl.glDepthMask(1) gl.glShadeModel(gl.GL_SMOOTH) if not isOpen: if spNote and self.threeDspin: gl.glRotate(90 + self.time / 3, 0, 1, 0) elif not spNote and self.noterotate: gl.glRotatef(90, 0, 1, 0) gl.glRotatef(-90, 1, 0, 0) if fret >= 0 and fret <= 4: gl.glRotate(self.noterot[fret], 0, 0, 1) gl.glTranslatef(0, self.notepos[fret], 0) texture = None if self.notetex: if isOpen: if self.opentexture_star: texture = self.opentexture_star elif self.opentexture_stara and self.starPowerActive: texture = self.opentexture_stara elif self.opentexture: texture = self.opentexture elif self.startex and spNote: texture = getattr(self, "startex" + chr(97 + fret)) elif self.spActTex and spAct: texture = self.spActTex elif self.staratex and self.starPowerActive: texture = getattr(self, "staratex" + chr(97 + fret)) else: texture = getattr(self, "notetex" + chr(97 + fret)) self.render3DNote(texture, meshObj, color, isTappable) gl.glDepthMask(0) gl.glPopMatrix() gl.glDisable(gl.GL_DEPTH_TEST)
def renderNeck(self, visibility, song, pos): if not song: return if not song.readyToGo: return v = visibility offset = (pos - self.lastBpmChange) / self.currentPeriod + self.baseBeat #myfingershurt: every theme can have oNeck: if self.guitarSolo and self.soloNeck and self.guitarSoloNeckMode == 1: neck = self.soloNeck elif self.scoreMultiplier > 4 and self.bassGrooveNeck and self.bassGrooveNeckMode == 1: neck = self.bassGrooveNeck elif self.fourxNeckMode == 1 and self.fourMultiNeck and self.scoreMultiplier == 4: neck = self.fourMultiNeck elif self.instrument.starPowerActive and not ( self.spcount2 != 0 and self.spcount < 1.2 ) and self.oNeck and self.scoreMultiplier <= 4 and not self.ovrneckoverlay: neck = self.oNeck else: neck = self.neckDrawing self.renderNeckMethod(v * self.neckAlpha[1], offset, neck) if self.guitarSolo and self.soloNeck and self.guitarSoloNeckMode == 2: #static overlay self.renderNeckMethod(v * self.neckAlpha[2], 0, self.soloNeck) if self.bgcount > 0 and self.bassGrooveNeck and self.bassGrooveNeckMode == 2: #static bass groove overlay self.renderNeckMethod(v * self.bgcount * self.neckAlpha[3], 0, self.bassGrooveNeck) if self.fourXcount > 0 and self.fourMultiNeck and self.fourxNeckMode == 2: #4x multi overlay neck self.renderNeckMethod(v * self.fourXcount * self.neckAlpha[6], offset, self.fourMultiNeck) if self.spcount2 != 0 and self.spcount < 1.2 and self.oNeck: #static overlay if self.oNeckovr and (self.scoreMultiplier > 4 or self.guitarSolo or self.ovrneckoverlay): neck = self.oNeckovr alpha = False else: neck = self.oNeck alpha = True self.renderNeckMethod(v * self.spcount * self.neckAlpha[4], offset, neck, alpha) if self.instrument.starPowerActive and not ( self.spcount2 != 0 and self.spcount < 1.2) and self.oNeck and ( self.scoreMultiplier > 4 or self.guitarSolo or self.ovrneckoverlay): #static overlay if self.oNeckovr: neck = self.oNeckovr alpha = False else: neck = self.oNeck alpha = True self.renderNeckMethod(v * self.neckAlpha[4], offset, neck, alpha) if shaders.enabled: shaders.globals["basspos"] = shaders.var["fret"][self.player][0] shaders.globals["notepos"] = shaders.var["fret"][self.player][1:] shaders.globals["bpm"] = self.instrument.currentBpm shaders.globals["songpos"] = pos shaders.globals["spEnabled"] = self.instrument.starPowerActive shaders.globals["isFailing"] = self.isFailing shaders.globals["isMultChanged"] = ( shaders.var["scoreMult"][self.player] != self.scoreMultiplier) if shaders.globals["isMultChanged"]: shaders.var["multChangePos"][self.player] = pos shaders.globals["scoreMult"] = self.scoreMultiplier shaders.var["scoreMult"][self.player] = self.scoreMultiplier shaders.globals["isDrum"] = self.isDrum shaders.globals["soloActive"] = self.guitarSolo posx = shaders.time() neckcol = (0, 0, 0) notecolors = list(self.engine.theme.noteColors) if self.isDrum: notecolors[4] = notecolors[0] notecolors[0] = self.engine.theme.noteColors[5] for i in range(5): blend = max(shaders.var["fret"][self.player][i] - posx + 1.5, 0.01) neckcol = mixColors(neckcol, notecolors[i], blend) shaders.var["color"][self.player] = neckcol if shaders.enable("neck"): shaders.setVar("fretcol", neckcol) shaders.update() cmgl.drawArrays(gl.GL_TRIANGLE_STRIP, vertices=self.shader_neck_vtx) shaders.disable() else: if self.isFailing: self.renderNeckMethod(self.failcount, 0, self.failNeck) if (self.guitarSolo or self.instrument.starPowerActive) and self.theme == 1: shaders.var["solocolor"] = self.shaderSolocolor else: shaders.var["solocolor"] = (0.0, ) * 4
def renderNotes(self, visibility, song, pos): if not song: return if not song.readyToGo: return self.bigMax = 0 # Update dynamic period self.currentPeriod = self.neckSpeed self.targetPeriod = self.neckSpeed self.killPoints = False w = self.boardWidth / self.strings self.starNotesInView = False self.openStarNotesInView = False renderedNotes = reversed(self.getRequiredNotesForRender(song,pos)) for time, event in renderedNotes: if isinstance(event, Tempo): self.tempoBpm = event.bpm if self.lastBpmChange > 0 and self.disableVBPM == True: continue if (pos - time > self.currentPeriod or self.lastBpmChange < 0) and time > self.lastBpmChange: self.baseBeat += (time - self.lastBpmChange) / self.currentPeriod self.targetBpm = event.bpm self.lastBpmChange = time self.neck.lastBpmChange = time self.neck.baseBeat = self.baseBeat continue if not isinstance(event, Note): continue if (event.noteBpm == 0.0): event.noteBpm = self.tempoBpm if event.number == 0 and self.isDrum: #MFH - skip all open notes continue if self.coOpFailed: if self.coOpRestart: if time - self.coOpRescueTime < (self.currentPeriod * self.beatsPerBoard * 2): continue elif self.coOpRescueTime + (self.currentPeriod * self.beatsPerBoard * 2) < pos: self.coOpFailed = False self.coOpRestart = False Log.debug("Turning off coOpFailed. Rescue successful.") else: continue #can't break. Tempo. x = (self.strings / 2 - (event.number)) * w c = self.fretColors[event.number] if event.number == 4 and self.isDrum: c = self.fretColors[0] #myfingershurt: need to swap note 0 and note 4 colors for drums: z = ((time - pos) / self.currentPeriod) / self.beatsPerUnit z2 = ((time + event.length - pos) / self.currentPeriod) / self.beatsPerUnit if z > self.boardLength * .8: f = (self.boardLength - z) / (self.boardLength * .2) elif z < 0: f = min(1, max(0, 1 + z2)) else: f = 1.0 #volshebnyi - hide notes in BRE zone if BRE enabled if self.freestyleEnabled: if time > self.freestyleStart - self.freestyleOffset and time < self.freestyleStart + self.freestyleOffset + self.freestyleLength: z = -2.0 if self.twoDnote == True and not self.useFretColors: color = (1,1,1, 1 * visibility * f) else: color = (.1 + .8 * c[0], .1 + .8 * c[1], .1 + .8 * c[2], 1 * visibility * f) if event.length > 120: length = (event.length - 50) / self.currentPeriod / self.beatsPerUnit else: length = 0 tailOnly = False spNote = False #myfingershurt: user setting for starpower refill / replenish notes if self.starPowerActive: if self.spRefillMode == 0: #mode 0 = no starpower / overdrive refill notes self.spEnabled = False elif self.spRefillMode == 1 and self.theme != 2: #mode 1 = overdrive refill notes in RB themes only self.spEnabled = False elif self.spRefillMode == 2 and song.midiStyle != 1: #mode 2 = refill based on MIDI type self.spEnabled = False if event.star: self.starNotesInView = True if event.finalStar: self.finalStarSeen = True self.starNotesInView = True if event.star and self.spEnabled: spNote = True if event.finalStar and self.spEnabled: spNote = True if event.played or event.hopod: if event.flameCount < 1 and not self.starPowerGained: if self.starPower < 50: #not enough starpower to activate yet, kill existing drumfills for dfEvent in self.drumFillEvents: dfEvent.happened = True Log.debug("star power added") if self.gameMode2p == 6 and not self.isDrum: if self.battleSuddenDeath: self.battleObjects = [1] + self.battleObjects[:2] else: self.battleObjects = [self.battleObjectsEnabled[random.randint(0,len(self.battleObjectsEnabled)-1)]] + self.battleObjects[:2] self.battleGetTime = pos self.battleObjectGained = True Log.debug("Battle Object Gained, Objects %s" % str(self.battleObjects)) else: if self.starPower < 100: self.starPower += 25 if self.starPower > 100: self.starPower = 100 self.overdriveFlashCount = 0 #MFH - this triggers the oFlash strings & timer self.starPowerGained = True if event.tappable < 2: isTappable = False else: isTappable = True if (event.played or event.hopod): #if the note is hit continue elif z < 0: #Notes past frets #if none of the below they keep on going, it would be self.notedisappear == 1 if self.notedisappear == 0: #Notes disappear continue elif self.notedisappear == 2: #Notes turn red color = (1, 0, 0, 1)#turn note red if z + length < -1.0: continue if event.length <= 120: length = None sustain = False if event.length > (1.4 * (60000.0 / event.noteBpm) / 4): sustain = True glPushMatrix() glTranslatef(x, 0, z) if shaders.turnon: shaders.setVar("note_position",(x, (1.0 - visibility) ** (event.number + 1), z),"notes") if self.battleStatus[8]: renderNote = random.randint(0,2) else: renderNote = 0 if renderNote == 0: self.renderNote(length, sustain = sustain, color = color, tailOnly = tailOnly, isTappable = isTappable, string = event.lane, fret = event.number, spNote = spNote) glPopMatrix() #myfingershurt: end FOR loop / note rendering loop if (not self.openStarNotesInView) and (not self.starNotesInView) and self.finalStarSeen: self.spEnabled = True self.isStarPhrase = False self.finalStarSeen = False