Example #1
0
    def renderNeckMethod(self, visibility, offset, neck, alpha = False): #blazingamer: New neck rendering method

        v = visibility

        glEnable(GL_TEXTURE_2D)

        if offset == 0:
            board_tex = self.board_tex_static
        else:
            board_tex = self.board_tex

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

        if alpha == True:
            glBlendFunc(GL_ONE, GL_ONE)
        if neck:
            neck.texture.bind()
        cmgl.drawArrays(GL_TRIANGLE_STRIP, vertices=self.board_vtx, colors=board_col, texcoords=board_tex)

        if alpha == True:
            glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)

        glDisable(GL_TEXTURE_2D)
Example #2
0
File: Neck.py Project: htvu/fofix
    def drawBPM(self, visibility, song, pos):
        if not song:
            return
        if not song.readyToGo:
            return

        track = song.track[self.player]

        gl.glEnable(gl.GL_TEXTURE_2D)

        for time, event in track.getEvents(pos - self.currentPeriod * 2, pos + self.currentPeriod * self.beatsPerBoard):
            if not isinstance(event, Bars):
                continue

            gl.glPushMatrix()
            z  = ((time - pos) / self.currentPeriod) / self.beatsPerUnit
            sw = 0.1 #width

            self.bpm_vtx[0][2] = self.bpm_vtx[2][2] = z + sw
            self.bpm_vtx[1][2] = self.bpm_vtx[3][2] = z - sw

            if event.barType == 0: #half-beat
                self.bpm_halfbeat.texture.bind()
            elif event.barType == 1: #beat
                self.bpm_beat.texture.bind()
            elif event.barType == 2: #measure
                self.bpm_measure.texture.bind()

            cmgl.drawArrays(gl.GL_TRIANGLE_STRIP, vertices=self.bpm_vtx, colors=self.bpm_col, texcoords=self.bpm_tex)

            gl.glPopMatrix()

        gl.glDisable(gl.GL_TEXTURE_2D)
Example #3
0
File: Neck.py Project: htvu/fofix
    def drawTrack(self, visibility, song, pos):
        if not song:
            return
        if not song.readyToGo:
            return

        if self.staticStrings:
            track_tex = self.board_tex_static
        else:
            track_tex = self.board_tex

        gl.glEnable(gl.GL_TEXTURE_2D)

        #MFH - logic to briefly display oFlash
        if self.overdriveFlashCount < self.overdriveFlashCounts and self.oFlash:
            self.oFlash.texture.bind()
        elif self.instrument.starPowerActive and self.oCenterLines:
            self.oCenterLines.texture.bind()
        else:
            if self.centerLines:
                self.centerLines.texture.bind()

        cmgl.drawArrays(gl.GL_TRIANGLE_STRIP, vertices=self.track_vtx, colors=self.board_col, texcoords=track_tex)

        gl.glDisable(gl.GL_TEXTURE_2D)
Example #4
0
    def renderIncomingNeck(
        self, visibility, song, pos, time, neckTexture
    ):  #MFH - attempt to "scroll" an incoming guitar solo neck towards the player
        if not song:
            return
        if not song.readyToGo:
            return

        l = self.boardLength
        z = ((time - pos) / self.currentPeriod) / self.beatsPerUnit

        gl.glEnable(gl.GL_TEXTURE_2D)

        self.board_scroll_vtx[0][2] = self.board_scroll_vtx[1][2] = z
        self.board_scroll_vtx[2][2] = self.board_scroll_vtx[3][2] = z + 1
        self.board_scroll_vtx[4][2] = self.board_scroll_vtx[5][
            2] = z + 2 + l * .7
        self.board_scroll_vtx[6][2] = self.board_scroll_vtx[7][2] = z + 2 + l

        if neckTexture:
            neckTexture.texture.bind()

        cmgl.drawArrays(gl.GL_TRIANGLE_STRIP,
                        vertices=self.board_scroll_vtx,
                        colors=self.board_col,
                        texcoords=self.board_tex_static)

        gl.glDisable(gl.GL_TEXTURE_2D)
Example #5
0
    def renderIncomingSideBars(self, song, pos, time, sideBarImg):
        if not song:
            return
        if not song.readyToGo:
            return

        l = self.boardLength
        z = ((time - pos) / self.currentPeriod) / self.beatsPerUnit

        gl.glEnable(gl.GL_TEXTURE_2D)

        self.sidebars_scroll_vtx[0][2] = self.sidebars_scroll_vtx[1][2] = z
        self.sidebars_scroll_vtx[2][2] = self.sidebars_scroll_vtx[3][2] = z + 1
        self.sidebars_scroll_vtx[4][2] = self.sidebars_scroll_vtx[5][
            2] = z + 2 + l * .7
        self.sidebars_scroll_vtx[6][2] = self.sidebars_scroll_vtx[7][
            2] = z + 2 + l

        if sideBarImg:
            sideBarImg.texture.bind()

        cmgl.drawArrays(gl.GL_TRIANGLE_STRIP,
                        vertices=self.sidebars_scroll_vtx,
                        colors=self.board_col,
                        texcoords=self.board_tex_static)

        gl.glDisable(gl.GL_TEXTURE_2D)
Example #6
0
    def drawBPM(self, visibility, song, pos):
        if not song:
            return
        if not song.readyToGo:
            return

        track = song.track[self.player]

        glEnable(GL_TEXTURE_2D)

        for time, event in track.getEvents(pos - self.currentPeriod * 2, pos + self.currentPeriod * self.beatsPerBoard):
            if not isinstance(event, Bars):
                continue

            glPushMatrix()
            z  = ((time - pos) / self.currentPeriod) / self.beatsPerUnit
            sw = 0.1 #width

            self.bpm_vtx[0][2] = self.bpm_vtx[2][2] = z + sw
            self.bpm_vtx[1][2] = self.bpm_vtx[3][2] = z - sw

            if event.barType == 0: #half-beat
                self.bpm_halfbeat.texture.bind()
            elif event.barType == 1: #beat
                self.bpm_beat.texture.bind()
            elif event.barType == 2: #measure
                self.bpm_measure.texture.bind()

            cmgl.drawArrays(GL_TRIANGLE_STRIP, vertices=self.bpm_vtx, colors=self.bpm_col, texcoords=self.bpm_tex)

            glPopMatrix()

        glDisable(GL_TEXTURE_2D)
Example #7
0
    def drawTrack(self, visibility, song, pos):
        if not song:
            return
        if not song.readyToGo:
            return

        if self.staticStrings:
            track_tex = self.board_tex_static
        else:
            track_tex = self.board_tex

        glEnable(GL_TEXTURE_2D)

        #MFH - logic to briefly display oFlash
        if self.overdriveFlashCount < self.overdriveFlashCounts and self.oFlash:
            self.oFlash.texture.bind()
        elif self.instrument.starPowerActive and self.oCenterLines:
            self.oCenterLines.texture.bind()
        else:
            if self.centerLines:
                self.centerLines.texture.bind()

        cmgl.drawArrays(GL_TRIANGLE_STRIP, vertices=self.track_vtx, colors=self.board_col, texcoords=track_tex)

        glDisable(GL_TEXTURE_2D)
Example #8
0
File: Neck.py Project: htvu/fofix
    def renderNeckMethod(self, visibility, offset, neck, alpha = False): #blazingamer: New neck rendering method

        v = visibility

        gl.glEnable(gl.GL_TEXTURE_2D)

        if offset == 0:
            board_tex = self.board_tex_static
        else:
            board_tex = self.board_tex

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

        if alpha == True:
            gl.glBlendFunc(gl.GL_ONE, gl.GL_ONE)
        if neck:
            neck.texture.bind()
        cmgl.drawArrays(gl.GL_TRIANGLE_STRIP, vertices=self.board_vtx, colors=board_col, texcoords=board_tex)

        if alpha == True:
            gl.glBlendFunc(gl.GL_SRC_ALPHA, gl.GL_ONE_MINUS_SRC_ALPHA)

        gl.glDisable(gl.GL_TEXTURE_2D)
Example #9
0
 def drawSquare(w, h, tw, th):
     self.square_prim[1, 0] = self.square_prim[3, 0] = w
     self.square_prim[2, 1] = self.square_prim[3, 1] = h
     self.square_tex[0, 1] = self.square_tex[1, 1] = th
     self.square_tex[1, 0] = self.square_tex[3, 0] = tw
     cmgl.drawArrays(GL_TRIANGLE_STRIP,
                     vertices=self.square_prim,
                     texcoords=self.square_tex)
Example #10
0
File: Font.py Project: fofix/fofix
    def drawSquare(self, w, h, tw, th):
        """
        New drawing relaying only on pygame.font.render
        Use arrays to increase performance

        :param w: width
        :param h: height
        :param tw: texture width
        :param th: texture height
        """
        self.square_prim[1, 0] = self.square_prim[3, 0] = w
        self.square_prim[2, 1] = self.square_prim[3, 1] = h
        self.square_tex[0, 1] = self.square_tex[1, 1] = th
        self.square_tex[1, 0] = self.square_tex[3, 0] = tw
        cmgl.drawArrays(GL_TRIANGLE_STRIP, vertices=self.square_prim, texcoords=self.square_tex)
Example #11
0
    def drawSquare(self, w, h, tw, th):
        """
        New drawing relaying only on pygame.font.render
        Use arrays to increase performance

        :param w: width
        :param h: height
        :param tw: texture width
        :param th: texture height
        """
        self.square_prim[1, 0] = self.square_prim[3, 0] = w
        self.square_prim[2, 1] = self.square_prim[3, 1] = h
        self.square_tex[0, 1] = self.square_tex[1, 1] = th
        self.square_tex[1, 0] = self.square_tex[3, 0] = tw
        cmgl.drawArrays(GL_TRIANGLE_STRIP,
                        vertices=self.square_prim,
                        texcoords=self.square_tex)
Example #12
0
File: Neck.py Project: htvu/fofix
    def renderIncomingSideBars(self, song, pos, time, sideBarImg):
        if not song:
            return
        if not song.readyToGo:
            return

        l = self.boardLength
        z = ((time - pos) / self.currentPeriod) / self.beatsPerUnit

        gl.glEnable(gl.GL_TEXTURE_2D)

        self.sidebars_scroll_vtx[0][2] = self.sidebars_scroll_vtx[1][2] = z
        self.sidebars_scroll_vtx[2][2] = self.sidebars_scroll_vtx[3][2] = z + 1
        self.sidebars_scroll_vtx[4][2] = self.sidebars_scroll_vtx[5][2] = z + 2 + l * .7
        self.sidebars_scroll_vtx[6][2] = self.sidebars_scroll_vtx[7][2] = z + 2 + l

        if sideBarImg:
            sideBarImg.texture.bind()

        cmgl.drawArrays(gl.GL_TRIANGLE_STRIP, vertices=self.sidebars_scroll_vtx, colors=self.board_col, texcoords=self.board_tex_static)

        gl.glDisable(gl.GL_TEXTURE_2D)
Example #13
0
    def draw(self):
        with cmgl.PushedSpecificMatrix(GL_TEXTURE):
            with cmgl.PushedSpecificMatrix(GL_PROJECTION):

                with cmgl.MatrixMode(GL_PROJECTION):
                    self.context.setProjection()

                with cmgl.PushedMatrix():
                    glLoadIdentity()

                    glTranslate(self.position[0], self.position[1], 0.0)
                    glRotatef(-self.angle, 0, 0, 1)
                    glScalef(self.scale[0], self.scale[1], 1.0)
                    glScalef(self.pixelSize[0], self.pixelSize[1], 1)
                    glTranslatef(self.shift, self.vshift, 0)

                    glColor4f(*self.color)

                    glEnable(GL_TEXTURE_2D)
                    self.texture.bind()
                    cmgl.drawArrays(GL_QUADS, vertices=ImgDrawing.VTX_ARRAY, texcoords=self.texArray)
                    glDisable(GL_TEXTURE_2D)
Example #14
0
File: Neck.py Project: htvu/fofix
    def renderIncomingNeck(self, visibility, song, pos, time, neckTexture):   #MFH - attempt to "scroll" an incoming guitar solo neck towards the player
        if not song:
            return
        if not song.readyToGo:
            return

        l = self.boardLength
        z = ((time - pos) / self.currentPeriod) / self.beatsPerUnit

        gl.glEnable(gl.GL_TEXTURE_2D)

        self.board_scroll_vtx[0][2] = self.board_scroll_vtx[1][2] = z
        self.board_scroll_vtx[2][2] = self.board_scroll_vtx[3][2] = z + 1
        self.board_scroll_vtx[4][2] = self.board_scroll_vtx[5][2] = z + 2 + l * .7
        self.board_scroll_vtx[6][2] = self.board_scroll_vtx[7][2] = z + 2 + l

        if neckTexture:
            neckTexture.texture.bind()

        cmgl.drawArrays(gl.GL_TRIANGLE_STRIP, vertices=self.board_scroll_vtx, colors=self.board_col, texcoords=self.board_tex_static)

        gl.glDisable(gl.GL_TEXTURE_2D)
Example #15
0
    def draw(self):
        with cmgl.PushedSpecificMatrix(GL_TEXTURE):
            with cmgl.PushedSpecificMatrix(GL_PROJECTION):

                with cmgl.MatrixMode(GL_PROJECTION):
                    self.context.setProjection()

                with cmgl.PushedMatrix():
                    glLoadIdentity()

                    glTranslate(self.position[0], self.position[1], 0.0)
                    glRotatef(-self.angle, 0, 0, 1)
                    glScalef(self.scale[0], self.scale[1], 1.0)
                    glScalef(self.pixelSize[0], self.pixelSize[1], 1)
                    glTranslatef(self.shift, self.vshift, 0)

                    glColor4f(*self.color)

                    glEnable(GL_TEXTURE_2D)
                    self.texture.bind()
                    cmgl.drawArrays(GL_QUADS, vertices=ImgDrawing.VTX_ARRAY, texcoords=self.texArray)
                    glDisable(GL_TEXTURE_2D)
Example #16
0
    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()
Example #17
0
File: Neck.py Project: htvu/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

        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()
Example #18
0
def draw3Dtex(image,
              vertex,
              texcoord,
              coord=None,
              scale=None,
              rot=None,
              color=(1, 1, 1),
              multiples=False,
              alpha=False,
              depth=False,
              vertscale=0):
    """
    Simplifies tex rendering

    :param image: tells the system which image/resource should be mapped to the plane
    :param vertex: (Left, Top, Right, Bottom) - sets the points that define where the plane will be drawn
    :param texcoord: (Left, Top, Right, Bottom) - sets where the texture should be drawn on the plane
    :param coord: (x, y, z) - where on the screen the plane will be rendered within the 3d field
    :param scale: (x, y, z) - scales an glplane how far in each direction
    :param rot: (degrees, x-axis, y-axis, z-axis) - a digit in the axis is how many times you want to rotate degrees around that axis
    :param color: (r,g,b) - sets the color of the image when rendered:
                  0 = No Color, 1 = Full color
    :param multiples: defines whether or not there should be multiples of the plane drawn at the same time.
                      Only really used with the rendering of the notes, keys, and flames
    :type multiples: boolean
    :param alpha: defines whether or not the image should have black turned into transparent.
                  Only really used with hitglows and flames
    :type alpha: boolean
    :param depth: sets the depth by which the object is rendered.
                  Only really used by keys and notes
    :type depth: boolean
    :param vertscale: changes the yscale when setting vertex points.
                      Only really used by notes
    """

    if not isinstance(image, ImgDrawing):
        return

    if alpha:
        glBlendFunc(GL_SRC_ALPHA, GL_ONE)

    if len(color) == 4:
        col_array = np.array([[color[0], color[1], color[2], color[3]],
                              [color[0], color[1], color[2], color[3]],
                              [color[0], color[1], color[2], color[3]],
                              [color[0], color[1], color[2], color[3]]],
                             dtype=np.float32)
    else:
        col_array = np.array([[color[0], color[1], color[2], 1],
                              [color[0], color[1], color[2], 1],
                              [color[0], color[1], color[2], 1],
                              [color[0], color[1], color[2], 1]],
                             dtype=np.float32)

    glEnable(GL_TEXTURE_2D)
    image.texture.bind()

    if multiples:
        glPushMatrix()

    if coord is not None:
        glTranslate(coord[0], coord[1], coord[2])
    if rot is not None:
        glRotate(rot[0], rot[1], rot[2], rot[3])
    if scale is not None:
        glScalef(scale[0], scale[1], scale[2])

    if depth:
        glDepthMask(1)

    if not isinstance(vertex, np.ndarray):
        vertex = np.array([[vertex[0], vertscale, vertex[1]],
                           [vertex[2], vertscale, vertex[1]],
                           [vertex[0], -vertscale, vertex[3]],
                           [vertex[2], -vertscale, vertex[3]]],
                          dtype=np.float32)

    if not isinstance(texcoord, np.ndarray):
        texcoord = np.array(
            [[texcoord[0], texcoord[1]], [texcoord[2], texcoord[1]],
             [texcoord[0], texcoord[3]], [texcoord[2], texcoord[3]]],
            dtype=np.float32)

    cmgl.drawArrays(GL_TRIANGLE_STRIP,
                    vertices=vertex,
                    colors=col_array,
                    texcoords=texcoord)

    if depth:
        glDepthMask(0)

    if multiples:
        glPopMatrix()

    glDisable(GL_TEXTURE_2D)

    if alpha:
        glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)
Example #19
0
 def drawSquare(w,h,tw,th):
     self.square_prim[1,0] = self.square_prim[3,0] = w
     self.square_prim[2,1] = self.square_prim[3,1] = h
     self.square_tex[0,1] = self.square_tex[1,1] = th
     self.square_tex[1,0] = self.square_tex[3,0] = tw
     cmgl.drawArrays(GL_TRIANGLE_STRIP, vertices=self.square_prim, texcoords=self.square_tex)
Example #20
0
def draw3Dtex(
    image,
    vertex,
    texcoord,
    coord=None,
    scale=None,
    rot=None,
    color=(1, 1, 1),
    multiples=False,
    alpha=False,
    depth=False,
    vertscale=0,
):
    """
    Simplifies tex rendering

    @param image: self.xxx - tells the system which image/resource should be mapped to the plane
    @param vertex: (Left, Top, Right, Bottom) - sets the points that define where the plane will be drawn
    @param texcoord: (Left, Top, Right, Bottom) - sets where the texture should be drawn on the plane
    @param coord: (x,y,z) - where on the screen the plane will be rendered within the 3d field
    @param scale: (x,y,z) - scales an glplane how far in each direction

    @param rot: (degrees, x-axis, y-axis, z-axis)
    a digit in the axis is how many times you want to rotate degrees around that axis

    @param color: (r,g,b) - sets the color of the image when rendered
    0 = No Color, 1 = Full color

    @param multiples: True/False
    defines whether or not there should be multiples of the plane drawn at the same time
    only really used with the rendering of the notes, keys, and flames

    @param alpha: True/False - defines whether or not the image should have black turned into transparent
    only really used with hitglows and flames

    @param depth: True/False - sets the depth by which the object is rendered
    only really used by keys and notes

    @param vertscale: # - changes the yscale when setting vertex points
    only really used by notes
    """

    if not isinstance(image, ImgDrawing):
        return

    if alpha:
        glBlendFunc(GL_SRC_ALPHA, GL_ONE)

    if len(color) == 4:
        col_array = np.array(
            [
                [color[0], color[1], color[2], color[3]],
                [color[0], color[1], color[2], color[3]],
                [color[0], color[1], color[2], color[3]],
                [color[0], color[1], color[2], color[3]],
            ],
            dtype=np.float32,
        )
    else:
        col_array = np.array(
            [
                [color[0], color[1], color[2], 1],
                [color[0], color[1], color[2], 1],
                [color[0], color[1], color[2], 1],
                [color[0], color[1], color[2], 1],
            ],
            dtype=np.float32,
        )

    glEnable(GL_TEXTURE_2D)
    image.texture.bind()

    if multiples:
        glPushMatrix()

    if coord is not None:
        glTranslate(coord[0], coord[1], coord[2])
    if rot is not None:
        glRotate(rot[0], rot[1], rot[2], rot[3])
    if scale is not None:
        glScalef(scale[0], scale[1], scale[2])

    if depth:
        glDepthMask(1)

    if not isinstance(vertex, np.ndarray):
        vertex = np.array(
            [
                [vertex[0], vertscale, vertex[1]],
                [vertex[2], vertscale, vertex[1]],
                [vertex[0], -vertscale, vertex[3]],
                [vertex[2], -vertscale, vertex[3]],
            ],
            dtype=np.float32,
        )

    if not isinstance(texcoord, np.ndarray):
        texcoord = np.array(
            [
                [texcoord[0], texcoord[1]],
                [texcoord[2], texcoord[1]],
                [texcoord[0], texcoord[3]],
                [texcoord[2], texcoord[3]],
            ],
            dtype=np.float32,
        )

    cmgl.drawArrays(GL_TRIANGLE_STRIP, vertices=vertex, colors=col_array, texcoords=texcoord)

    if depth:
        glDepthMask(0)

    if multiples:
        glPopMatrix()

    glDisable(GL_TEXTURE_2D)

    if alpha:
        glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)
Example #21
0
    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
Example #22
0
File: Neck.py Project: htvu/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.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