( x0, y0, x1, y1, x2, y2, u0, v0, u1, v1, u2, v2, texture )
| 15844 | } |
| 15845 | |
| 15846 | function patternPath( x0, y0, x1, y1, x2, y2, u0, v0, u1, v1, u2, v2, texture ) { |
| 15847 | |
| 15848 | if ( texture instanceof THREE.DataTexture || texture.image === undefined || texture.image.width == 0 ) return; |
| 15849 | |
| 15850 | if ( texture.needsUpdate === true ) { |
| 15851 | |
| 15852 | var repeatX = texture.wrapS == THREE.RepeatWrapping; |
| 15853 | var repeatY = texture.wrapT == THREE.RepeatWrapping; |
| 15854 | |
| 15855 | _patterns[ texture.id ] = _context.createPattern( |
| 15856 | texture.image, repeatX === true && repeatY === true |
| 15857 | ? 'repeat' |
| 15858 | : repeatX === true && repeatY === false |
| 15859 | ? 'repeat-x' |
| 15860 | : repeatX === false && repeatY === true |
| 15861 | ? 'repeat-y' |
| 15862 | : 'no-repeat' |
| 15863 | ); |
| 15864 | |
| 15865 | texture.needsUpdate = false; |
| 15866 | |
| 15867 | } |
| 15868 | |
| 15869 | _patterns[ texture.id ] === undefined |
| 15870 | ? setFillStyle( 'rgba(0,0,0,1)' ) |
| 15871 | : setFillStyle( _patterns[ texture.id ] ); |
| 15872 | |
| 15873 | // http://extremelysatisfactorytotalitarianism.com/blog/?p=2120 |
| 15874 | |
| 15875 | var a, b, c, d, e, f, det, idet, |
| 15876 | offsetX = texture.offset.x / texture.repeat.x, |
| 15877 | offsetY = texture.offset.y / texture.repeat.y, |
| 15878 | width = texture.image.width * texture.repeat.x, |
| 15879 | height = texture.image.height * texture.repeat.y; |
| 15880 | |
| 15881 | u0 = ( u0 + offsetX ) * width; |
| 15882 | v0 = ( 1.0 - v0 + offsetY ) * height; |
| 15883 | |
| 15884 | u1 = ( u1 + offsetX ) * width; |
| 15885 | v1 = ( 1.0 - v1 + offsetY ) * height; |
| 15886 | |
| 15887 | u2 = ( u2 + offsetX ) * width; |
| 15888 | v2 = ( 1.0 - v2 + offsetY ) * height; |
| 15889 | |
| 15890 | x1 -= x0; y1 -= y0; |
| 15891 | x2 -= x0; y2 -= y0; |
| 15892 | |
| 15893 | u1 -= u0; v1 -= v0; |
| 15894 | u2 -= u0; v2 -= v0; |
| 15895 | |
| 15896 | det = u1 * v2 - u2 * v1; |
| 15897 | |
| 15898 | if ( det === 0 ) { |
| 15899 | |
| 15900 | if ( _imagedatas[ texture.id ] === undefined ) { |
| 15901 | |
| 15902 | var canvas = document.createElement( 'canvas' ) |
| 15903 | canvas.width = texture.image.width; |
no test coverage detected