( x0, y0, x1, y1, x2, y2, u0, v0, u1, v1, u2, v2, texture )
| 16112 | } |
| 16113 | |
| 16114 | function patternPath( x0, y0, x1, y1, x2, y2, u0, v0, u1, v1, u2, v2, texture ) { |
| 16115 | |
| 16116 | if ( texture instanceof THREE.DataTexture || texture.image === undefined || texture.image.width == 0 ) return; |
| 16117 | |
| 16118 | if ( texture.needsUpdate === true ) { |
| 16119 | |
| 16120 | var repeatX = texture.wrapS == THREE.RepeatWrapping; |
| 16121 | var repeatY = texture.wrapT == THREE.RepeatWrapping; |
| 16122 | |
| 16123 | _patterns[ texture.id ] = _context.createPattern( |
| 16124 | texture.image, repeatX === true && repeatY === true |
| 16125 | ? 'repeat' |
| 16126 | : repeatX === true && repeatY === false |
| 16127 | ? 'repeat-x' |
| 16128 | : repeatX === false && repeatY === true |
| 16129 | ? 'repeat-y' |
| 16130 | : 'no-repeat' |
| 16131 | ); |
| 16132 | |
| 16133 | texture.needsUpdate = false; |
| 16134 | |
| 16135 | } |
| 16136 | |
| 16137 | _patterns[ texture.id ] === undefined |
| 16138 | ? setFillStyle( 'rgba(0,0,0,1)' ) |
| 16139 | : setFillStyle( _patterns[ texture.id ] ); |
| 16140 | |
| 16141 | // http://extremelysatisfactorytotalitarianism.com/blog/?p=2120 |
| 16142 | |
| 16143 | var a, b, c, d, e, f, det, idet, |
| 16144 | offsetX = texture.offset.x / texture.repeat.x, |
| 16145 | offsetY = texture.offset.y / texture.repeat.y, |
| 16146 | width = texture.image.width * texture.repeat.x, |
| 16147 | height = texture.image.height * texture.repeat.y; |
| 16148 | |
| 16149 | u0 = ( u0 + offsetX ) * width; |
| 16150 | v0 = ( 1.0 - v0 + offsetY ) * height; |
| 16151 | |
| 16152 | u1 = ( u1 + offsetX ) * width; |
| 16153 | v1 = ( 1.0 - v1 + offsetY ) * height; |
| 16154 | |
| 16155 | u2 = ( u2 + offsetX ) * width; |
| 16156 | v2 = ( 1.0 - v2 + offsetY ) * height; |
| 16157 | |
| 16158 | x1 -= x0; y1 -= y0; |
| 16159 | x2 -= x0; y2 -= y0; |
| 16160 | |
| 16161 | u1 -= u0; v1 -= v0; |
| 16162 | u2 -= u0; v2 -= v0; |
| 16163 | |
| 16164 | det = u1 * v2 - u2 * v1; |
| 16165 | |
| 16166 | if ( det === 0 ) { |
| 16167 | |
| 16168 | if ( _imagedatas[ texture.id ] === undefined ) { |
| 16169 | |
| 16170 | var canvas = document.createElement( 'canvas' ) |
| 16171 | canvas.width = texture.image.width; |
no test coverage detected