static _optimizeBuffer(zb) {
        // Optimisation ZBuffer -> suppression des renderScreenSlice inutile, élargissement des renderScreenSlice utiles.
        // si le last est null on le rempli
        // sinon on compare last et current
        // si l'un des indices 0, 1 diffèrent alors on flush, sinon on augmente le last
        let aZ = [];
        let nLast = 1;
        let nLLast = 1;
        let nLLLast = 1;
        let z = 1;

        // image 0
        // sx  1
        // sy  2
        // sw  3
        // sh  4
        // dx  5
        // dy  6
        // dw  7
        // dh  8
        // z   9
        // fx  10
        // id  11 identifiant image

        let zbl = zb.length;
        if (zbl === 0) {
            return [];
        }
        let b; // Element courrant du ZBuffer;
        let lb = zb[0];
        let llb = lb;
        let lllb = lb;
        let abs = Math.abs;

        for (let i = 0; i < zbl; i++) {
            b = zb[i];
            // tant que c'est la même source de texture=
            if (b[10] === lb[10] && b[0] === lb[0] && b[1] === lb[1] && abs(b[9] - lb[9]) < 8) {
                nLast += z;
            } else if (b[10] === llb[10] && b[0] === llb[0] && b[1] === llb[1] && abs(b[9] - llb[9]) < 8) {
                nLLast += z;
            } else if (b[10] === lllb[10] && b[0] === lllb[0] && b[1] === lllb[1] && abs(b[9] - lllb[9]) < 8) {
                nLLLast += z;
            } else {
                lllb[7] = nLLLast;
                aZ.push(lllb);
                lllb = llb;
                nLLLast = nLLast;
                llb = lb;
                nLLast = nLast;
                lb = b;
                nLast = z;
            }
        }
        lllb[7] = nLLLast;
        aZ.push(lllb);
        llb[7] = nLLast;
        aZ.push(llb);
        lb[7] = nLast;
        aZ.push(lb);

        return aZ;
    }
/**
     * optimizes buffer by gathering screen-slices that look alike (same texture, same size, same origin-column)
     * so it should reduce the number of screen-slices, and may replace several look-alike thin screen slice by a thicker one
     * this function returns another array with fewer items, if optimization worked well.
     * @param zb {array}
     * @returns {Array}
     * @private
     */
optimizes buffer by gathering screen-slices that look alike (same texture, same size, same origin-column)
so it should reduce the number of screen-slices, and may replace several look-alike thin screen slice by a thicker one
this function returns another array with fewer items, if optimization worked well.
@param zb {array}
@returns {Array}
@private
optimizes buffer by gathering screen - slices that look alike ( same texture same size same origin - column ) so it should reduce the number of screen - slices and may replace several look - alike thin screen slice by a thicker one this function returns another array with fewer items if optimization worked well . @param zb { array } @returns { Array } @private
static _optimizeBuffer(zb) {
        let aZ = [];
        let nLast = 1;
        let nLLast = 1;
        let nLLLast = 1;
        let z = 1;
        let zbl = zb.length;
        if (zbl === 0) {
            return [];
        }
        let b; 
        let lb = zb[0];
        let llb = lb;
        let lllb = lb;
        let abs = Math.abs;
        for (let i = 0; i < zbl; i++) {
            b = zb[i];
            if (b[10] === lb[10] && b[0] === lb[0] && b[1] === lb[1] && abs(b[9] - lb[9]) < 8) {
                nLast += z;
            } else if (b[10] === llb[10] && b[0] === llb[0] && b[1] === llb[1] && abs(b[9] - llb[9]) < 8) {
                nLLast += z;
            } else if (b[10] === lllb[10] && b[0] === lllb[0] && b[1] === lllb[1] && abs(b[9] - lllb[9]) < 8) {
                nLLLast += z;
            } else {
                lllb[7] = nLLLast;
                aZ.push(lllb);
                lllb = llb;
                nLLLast = nLLast;
                llb = lb;
                nLLast = nLast;
                lb = b;
                nLast = z;
            }
        }
        lllb[7] = nLLLast;
        aZ.push(lllb);
        llb[7] = nLLast;
        aZ.push(llb);
        lb[7] = nLast;
        aZ.push(lb);
        return aZ;
    }
static _optimizeBuffer ( zb ) { let aZ = [ ] ; let nLast = 1 ; let nLLast = 1 ; let nLLLast = 1 ; let z = 1 ; let zbl = zb . length ; if ( zbl === 0 ) { return [ ] ; } let b ; let lb = zb [ 0 ] ; let llb = lb ; let lllb = lb ; let abs = Math . abs ; for ( let i = 0 ; i < zbl ; i ++ ) { b = zb [ i ] ; if ( b [ 10 ] === lb [ 10 ] && b [ 0 ] === lb [ 0 ] && b [ 1 ] === lb [ 1 ] && abs ( b [ 9 ] - lb [ 9 ] ) < 8 ) { nLast += z ; } else if ( b [ 10 ] === llb [ 10 ] && b [ 0 ] === llb [ 0 ] && b [ 1 ] === llb [ 1 ] && abs ( b [ 9 ] - llb [ 9 ] ) < 8 ) { nLLast += z ; } else if ( b [ 10 ] === lllb [ 10 ] && b [ 0 ] === lllb [ 0 ] && b [ 1 ] === lllb [ 1 ] && abs ( b [ 9 ] - lllb [ 9 ] ) < 8 ) { nLLLast += z ; } else { lllb [ 7 ] = nLLLast ; aZ . push ( lllb ) ; lllb = llb ; nLLLast = nLLast ; llb = lb ; nLLast = nLast ; lb = b ; nLast = z ; } } lllb [ 7 ] = nLLLast ; aZ . push ( lllb ) ; llb [ 7 ] = nLLast ; aZ . push ( llb ) ; lb [ 7 ] = nLast ; aZ . push ( lb ) ; return aZ ; }
optimizes buffer by gathering screen-slices that look alike (same texture, same size, same origin-column)
 so it should reduce the number of screen-slices, and may replace several look-alike thin screen slice by a thicker one
 this function returns another array with fewer items, if optimization worked well.
optimizes buffer by gathering screen - slices that look alike ( same texture same size same origin - column ) so it should reduce the number of screen - slices and may replace several look - alike thin screen slice by a thicker one this function returns another array with fewer items if optimization worked well .
// Optimisation ZBuffer -> suppression des renderScreenSlice inutile, élargissement des renderScreenSlice utiles. // si le last est null on le rempli // sinon on compare last et current // si l'un des indices 0, 1 diffèrent alors on flush, sinon on augmente le last // image 0 // sx  1 // sy  2 // sw  3 // sh  4 // dx  5 // dy  6 // dw  7 // dh  8 // z   9 // fx  10 // id  11 identifiant image // Element courrant du ZBuffer; // tant que c'est la même source de texture=