示例#1
0
文件: Stage.py 项目: HugoLnx/fofix
  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)
      glBegin(GL_TRIANGLE_STRIP)
      glVertex3f(-8.0, 1.0,7.0)
      glVertex3f(8.0, 1.0,7.0)
      glVertex3f(-8.0, 4.0,7.0)
      glVertex3f(8.0, 4.0,7.0)
      glEnd()    
      shaders.disable()
      
    self.scene.renderGuitar()
    self.renderLayers(self.foregroundLayers, visibility)
    self.rockmeter.render(visibility)
示例#2
0
文件: Stage.py 项目: maggotgdv/fofix
    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)
            glBegin(GL_TRIANGLE_STRIP)
            glVertex3f(-8.0, 1.0, 7.0)
            glVertex3f(8.0, 1.0, 7.0)
            glVertex3f(-8.0, 4.0, 7.0)
            glVertex3f(8.0, 4.0, 7.0)
            glEnd()
            shaders.disable()

        self.scene.renderGuitar()
        self.renderLayers(self.foregroundLayers, visibility)
        self.rockmeter.render(visibility)
示例#3
0
文件: Neck.py 项目: west2554/fofix
  def drawSideBars(self, visibility, song, pos):
    if not song:
      return
    if not song.readyToGo:
      return

    def project(beat):
      return 0.125 * beat / self.beatsPerUnit  # glorandwarf: was 0.12

    v            = visibility
    w            = self.boardWidth + 0.15
    l            = self.boardLength

    offset       = (pos - self.lastBpmChange) / self.currentPeriod + self.baseBeat 

    c = (1,1,1)

    board_tex  = np.array([[0.0, project(offset - 2 * self.beatsPerUnit)],
                         [1.0, project(offset - 2 * self.beatsPerUnit)],
                         [0.0, project(offset - 1 * self.beatsPerUnit)],
                         [1.0, project(offset - 1 * self.beatsPerUnit)],
                         [0.0, project(offset + l * self.beatsPerUnit * .7)],
                         [1.0, project(offset + l * self.beatsPerUnit * .7)],
                         [0.0, project(offset + l * self.beatsPerUnit)],
                         [1.0, project(offset + l * self.beatsPerUnit)]], dtype=np.float32)

    glEnable(GL_TEXTURE_2D)
    if self.theme == 2 and self.instrument.starPowerActive and self.oSideBars:
      self.oSideBars.texture.bind()
    else:
      self.sideBars.texture.bind()

    cmgl.drawArrays(GL_TRIANGLE_STRIP, vertices=self.sidebars_vtx, colors=self.board_col, texcoords=board_tex)
    
    glDisable(GL_TEXTURE_2D)
    
    if self.theme == 1:   
      if shaders.enable("sololight"):
        shaders.modVar("color",shaders.var["solocolor"])
        shaders.setVar("offset",(-3.5,-w/2))
        glBegin(GL_TRIANGLE_STRIP)
        glVertex3f(w / 2-1.0, 0.4, -2)
        glVertex3f(w / 2+1.0, 0.4, -2)
        glVertex3f(w / 2-1.0, 0.4, l)
        glVertex3f(w / 2+1.0, 0.4, l)
        glEnd()   
        shaders.setVar("offset",(-3.5,w/2))
        shaders.setVar("time",shaders.time()+0.5)
        glBegin(GL_TRIANGLE_STRIP)
        glVertex3f(-w / 2+1.0, 0.4, -2)
        glVertex3f(-w / 2-1.0, 0.4, -2)
        glVertex3f(-w / 2+1.0, 0.4, l)
        glVertex3f(-w / 2-1.0, 0.4, l)
        glEnd()  
        shaders.disable()
示例#4
0
文件: Neck.py 项目: davwong/fofix
  def drawSideBars(self, visibility, song, pos):
    if not song:
      return
    if not song.readyToGo:
      return

    color = (1,1,1)

    v            = visibility
    w            = self.boardWidth + 0.15
    l            = self.boardLength

    offset       = (pos - self.lastBpmChange) / self.currentPeriod + self.baseBeat 

    board_tex  = np.array([[0.0, self.project(offset - 2 * self.beatsPerUnit)],
                         [1.0, self.project(offset - 2 * self.beatsPerUnit)],
                         [0.0, self.project(offset - 1 * self.beatsPerUnit)],
                         [1.0, self.project(offset - 1 * self.beatsPerUnit)],
                         [0.0, self.project(offset + l * self.beatsPerUnit * .7)],
                         [1.0, self.project(offset + l * self.beatsPerUnit * .7)],
                         [0.0, self.project(offset + l * self.beatsPerUnit)],
                         [1.0, self.project(offset + l * self.beatsPerUnit)]], dtype=np.float32)

    #must be separate for sidebar flashing.
    board_col  = np.array([[color[0],color[1],color[2], 0],
                             [color[0],color[1],color[2], 0],
                             [color[0],color[1],color[2], v],
                             [color[0],color[1],color[2], v],
                             [color[0],color[1],color[2], v],
                             [color[0],color[1],color[2], v],
                             [color[0],color[1],color[2], 0],
                             [color[0],color[1],color[2], 0]], dtype=np.float32)

    glEnable(GL_TEXTURE_2D)
    if self.instrument.starPowerActive and self.oSideBars:
      self.oSideBars.texture.bind()
    else:
      self.sideBars.texture.bind()
    if self.isFailing and self.failSideBars and v == self.failcount:
      self.failSideBars.texture.bind()
    else:
      self.sideBars.texture.bind()
    cmgl.drawArrays(GL_TRIANGLE_STRIP, vertices=self.sidebars_vtx, colors=board_col, texcoords=board_tex)
    glDisable(GL_TEXTURE_2D)
     
    if shaders.enable("sololight"):
      shaders.modVar("color",shaders.var["solocolor"])
      shaders.setVar("offset",(-3.5,-w/2))
      cmgl.drawArrays(GL_TRIANGLE_STRIP, vertices=self.soloLightVtx1)
      shaders.setVar("offset",(-3.5,w/2))
      shaders.setVar("time",shaders.time()+0.5)
      cmgl.drawArrays(GL_TRIANGLE_STRIP, vertices=self.soloLightVtx2) 
      shaders.disable()
示例#5
0
文件: Neck.py 项目: chk666/fofix
    def drawSideBars(self, visibility, song, pos):
        if not song:
            return
        if not song.readyToGo:
            return

        color = (1,1,1)

        v = visibility
        w = self.boardWidth + 0.15

        if self.failcount == v:
            board_col = self.board_col_flash
        else:
            board_col = self.board_col

        glEnable(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_TRIANGLE_STRIP, vertices=self.sidebars_vtx, colors=board_col, texcoords=self.board_tex)
        glDisable(GL_TEXTURE_2D)

        if shaders.enable("sololight"):
            shaders.modVar("color",shaders.var["solocolor"])
            shaders.setVar("offset",(-3.5,-w/2))
            cmgl.drawArrays(GL_TRIANGLE_STRIP, vertices=self.soloLightVtx1)
            shaders.setVar("offset",(-3.5,w/2))
            shaders.setVar("time",shaders.time()+0.5)
            cmgl.drawArrays(GL_TRIANGLE_STRIP, vertices=self.soloLightVtx2)
            shaders.disable()
示例#6
0
文件: Neck.py 项目: maggotgdv/fofix
    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

        glEnable(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_TRIANGLE_STRIP, vertices=self.sidebars_vtx, colors=board_col, texcoords=self.board_tex)
        glDisable(GL_TEXTURE_2D)

        if shaders.enable("sololight"):
            shaders.modVar("color",shaders.var["solocolor"])
            shaders.setVar("offset",(-3.5,-w/2))
            cmgl.drawArrays(GL_TRIANGLE_STRIP, vertices=self.soloLightVtx1)
            shaders.setVar("offset",(-3.5,w/2))
            shaders.setVar("time",shaders.time()+0.5)
            cmgl.drawArrays(GL_TRIANGLE_STRIP, vertices=self.soloLightVtx2)
            shaders.disable()
示例#7
0
文件: Neck.py 项目: west2554/fofix
  def renderNeck(self, visibility, song, pos):     
    if not song:
      return
    if not song.readyToGo:
      return
    
    v            = visibility
    w            = self.boardWidth
    l            = self.boardLength

    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.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)
      
    elif 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.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()
      fret = []
      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()
      glBegin(GL_TRIANGLE_STRIP)
      glVertex3f(-w / 2, 0.1, -2)
      glVertex3f(w / 2, 0.1, -2)
      glVertex3f(-w / 2, 0.1, l)
      glVertex3f(w / 2, 0.1, l)
      glEnd()
      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
示例#8
0
文件: Neck.py 项目: maggotgdv/fofix
    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_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
示例#9
0
文件: Drum.py 项目: donut87/fofix
    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]

            self.engine.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

            glPushMatrix()
            glEnable(GL_DEPTH_TEST)
            glDepthMask(1)
            glShadeModel(GL_SMOOTH)

            if not isOpen:
                if spNote and self.threeDspin:
                    glRotate(90 + self.time / 3, 0, 1, 0)
                elif not spNote and self.noterotate:
                    glRotatef(90, 0, 1, 0)
                    glRotatef(-90, 1, 0, 0)

            if fret >= 0 and fret <= 4:
                glRotate(self.noterot[fret], 0, 0, 1)
                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)

            glDepthMask(0)
            glPopMatrix()
            glDisable(GL_DEPTH_TEST)
示例#10
0
  def drawSideBars(self, visibility, song, pos):
    if not song:
      return
    if not song.readyToGo:
      return

    def project(beat):
      return 0.125 * beat / self.beatsPerUnit  # glorandwarf: was 0.12

    v            = visibility
    w            = self.boardWidth + 0.15
    l            = self.boardLength

    offset       = (pos - self.lastBpmChange) / self.currentPeriod + self.baseBeat 

    c = (1,1,1)

    board_tex  = array([[0.0, project(offset - 2 * self.beatsPerUnit)],
                         [1.0, project(offset - 2 * self.beatsPerUnit)],
                         [0.0, project(offset - 1 * self.beatsPerUnit)],
                         [1.0, project(offset - 1 * self.beatsPerUnit)],
                         [0.0, project(offset + l * self.beatsPerUnit * .7)],
                         [1.0, project(offset + l * self.beatsPerUnit * .7)],
                         [0.0, project(offset + l * self.beatsPerUnit)],
                         [1.0, project(offset + l * self.beatsPerUnit)]], dtype=float32)

    glEnable(GL_TEXTURE_2D)
    if self.theme == 2 and self.starPowerActive and self.oSideBars:
      self.oSideBars.texture.bind()
    else:
      self.sideBars.texture.bind()

    glEnableClientState(GL_VERTEX_ARRAY)
    glEnableClientState(GL_COLOR_ARRAY)
    glEnableClientState(GL_TEXTURE_COORD_ARRAY);
    glVertexPointerf(self.sidebars_vtx)
    glColorPointerf(self.board_col)
    glTexCoordPointerf(board_tex)
    glDrawArrays(GL_TRIANGLE_STRIP, 0, self.sidebars_vtx.shape[0])
    glDisableClientState(GL_VERTEX_ARRAY)
    glDisableClientState(GL_COLOR_ARRAY)
    glDisableClientState(GL_TEXTURE_COORD_ARRAY);
    
    glDisable(GL_TEXTURE_2D)
    
    if self.theme == 1:   
      if shaders.enable("sololight"):
        shaders.modVar("color",shaders.var["solocolor"])
        shaders.setVar("offset",(-3.5,-w/2))
        glBegin(GL_TRIANGLE_STRIP)
        glVertex3f(w / 2-1.0, 0.4, -2)
        glVertex3f(w / 2+1.0, 0.4, -2)
        glVertex3f(w / 2-1.0, 0.4, l)
        glVertex3f(w / 2+1.0, 0.4, l)
        glEnd()   
        shaders.setVar("offset",(-3.5,w/2))
        shaders.setVar("time",shaders.time()+0.5)
        glBegin(GL_TRIANGLE_STRIP)
        glVertex3f(-w / 2+1.0, 0.4, -2)
        glVertex3f(-w / 2-1.0, 0.4, -2)
        glVertex3f(-w / 2+1.0, 0.4, l)
        glVertex3f(-w / 2-1.0, 0.4, l)
        glEnd()  
        shaders.disable()
示例#11
0
  def renderNeck(self, visibility, song, pos):     
    if not song:
      return
    if not song.readyToGo:
      return
    
    v            = visibility
    w            = self.boardWidth
    l            = self.boardLength

    offset       = (pos - self.lastBpmChange) / self.currentPeriod + self.baseBeat 

    #myfingershurt: every theme can have oNeck:

    if self.guitarSolo and self.guitarSoloNeck != None and self.guitarSoloNeckMode == 1:
      neck = self.guitarSoloNeck
    elif self.scoreMultiplier > 4 and self.bassGrooveNeck != None and self.bassGrooveNeckMode == 1:
      neck = self.bassGrooveNeck
    elif self.starPowerActive and not (self.spcount2 != 0 and self.spcount < 1.2) and self.oNeck and self.scoreMultiplier <= 4 and self.ovrneckoverlay == False:
      neck = self.oNeck
    else:
      neck = self.neckDrawing

    
    if not (self.guitarSolo and self.guitarSoloNeck != None and self.guitarSoloNeckMode == 2):
      self.renderNeckMethod(v*self.neckAlpha[1], offset, neck)
    
    if self.bgcount > 0 and self.bassGrooveNeck != None and self.bassGrooveNeckMode == 2:   #static bass groove overlay
      self.renderNeckMethod(v*self.bgcount*self.neckAlpha[3], 0, self.bassGrooveNeck)
      
    elif self.guitarSolo and self.guitarSoloNeck != None and self.guitarSoloNeckMode == 2:   #static overlay
      self.renderNeckMethod(v*self.neckAlpha[2], 0, self.guitarSoloNeck)
      
    if self.spcount2 != 0 and self.spcount < 1.2 and self.oNeck:   #static overlay
      if self.oNeckovr != None and (self.scoreMultiplier > 4 or self.guitarSolo or self.ovrneckoverlay == True):
        neck = self.oNeckovr
        alpha = False
      else:
        neck = self.oNeck
        alpha = True          

      self.renderNeckMethod(v*self.spcount*self.neckAlpha[4], offset, neck, alpha)
      
    
      
    if self.starPowerActive and not (self.spcount2 != 0 and self.spcount < 1.2) and self.oNeck and (self.scoreMultiplier > 4 or self.guitarSolo or self.ovrneckoverlay == True):   #static overlay
      if self.oNeckovr != None:
        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.currentBpm
      shaders.globals["songpos"] = pos
      shaders.globals["spEnabled"] = self.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()
      fret = []
      neckcol = (0,0,0)
      
      notecolors = list(Theme.fretColors)
      if self.isDrum:
        notecolors[4] = notecolors[0]
        notecolors[0] = Theme.opencolor
        
        
      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()
      glBegin(GL_TRIANGLE_STRIP)
      glVertex3f(-w / 2, 0.1, -2)
      glVertex3f(w / 2, 0.1, -2)
      glVertex3f(-w / 2, 0.1, l)
      glVertex3f(w / 2, 0.1, l)
      glEnd()
      shaders.disable()
    else:
      if self.isFailing:
        self.renderNeckMethod(self.failcount, 0, self.failNeck)
        
    if (self.guitarSolo or self.starPowerActive) and self.theme == 1:
      shaders.var["solocolor"]=(0.3,0.7,0.9,0.6)
    else:
      shaders.var["solocolor"]=(0.0,)*4
示例#12
0
    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
示例#13
0
    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]

            self.engine.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

            glPushMatrix()
            glEnable(GL_DEPTH_TEST)
            glDepthMask(1)
            glShadeModel(GL_SMOOTH)

            if not isOpen:
                if spNote and self.threeDspin:
                    glRotate(90 + self.time / 3, 0, 1, 0)
                elif not spNote and self.noterotate:
                    glRotatef(90, 0, 1, 0)
                    glRotatef(-90, 1, 0, 0)

            if fret >= 0 and fret <= 4:
                glRotate(self.noterot[fret], 0, 0, 1)
                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)

            glDepthMask(0)
            glPopMatrix()
            glDisable(GL_DEPTH_TEST)
示例#14
0
    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