( x0, y0, x1, y1, x2, y2, u0, v0, u1, v1, u2, v2, texture )
| 12219 | } |
| 12220 | |
| 12221 | function patternPath( x0, y0, x1, y1, x2, y2, u0, v0, u1, v1, u2, v2, texture ) { |
| 12222 | |
| 12223 | if ( texture.image === undefined || texture.image.width === 0 ) return; |
| 12224 | |
| 12225 | if ( texture.needsUpdate === true || _patterns[ texture.id ] === undefined ) { |
| 12226 | |
| 12227 | var repeatX = texture.wrapS == THREE.RepeatWrapping; |
| 12228 | var repeatY = texture.wrapT == THREE.RepeatWrapping; |
| 12229 | |
| 12230 | _patterns[ texture.id ] = _context.createPattern( texture.image, repeatX === true && repeatY === true ? 'repeat' : repeatX === true && repeatY === false ? 'repeat-x' : repeatX === false && repeatY === true ? 'repeat-y' : 'no-repeat' ); |
| 12231 | |
| 12232 | texture.needsUpdate = false; |
| 12233 | |
| 12234 | } |
| 12235 | |
| 12236 | setFillStyle( _patterns[ texture.id ] ); |
| 12237 | |
| 12238 | // http://extremelysatisfactorytotalitarianism.com/blog/?p=2120 |
| 12239 | |
| 12240 | var a, b, c, d, e, f, det, idet, |
| 12241 | offsetX = texture.offset.x / texture.repeat.x, |
| 12242 | offsetY = texture.offset.y / texture.repeat.y, |
| 12243 | width = texture.image.width * texture.repeat.x, |
| 12244 | height = texture.image.height * texture.repeat.y; |
| 12245 | |
| 12246 | u0 = ( u0 + offsetX ) * width; |
| 12247 | v0 = ( 1.0 - v0 + offsetY ) * height; |
| 12248 | |
| 12249 | u1 = ( u1 + offsetX ) * width; |
| 12250 | v1 = ( 1.0 - v1 + offsetY ) * height; |
| 12251 | |
| 12252 | u2 = ( u2 + offsetX ) * width; |
| 12253 | v2 = ( 1.0 - v2 + offsetY ) * height; |
| 12254 | |
| 12255 | x1 -= x0; y1 -= y0; |
| 12256 | x2 -= x0; y2 -= y0; |
| 12257 | |
| 12258 | u1 -= u0; v1 -= v0; |
| 12259 | u2 -= u0; v2 -= v0; |
| 12260 | |
| 12261 | det = u1 * v2 - u2 * v1; |
| 12262 | |
| 12263 | if ( det === 0 ) { |
| 12264 | |
| 12265 | if ( _imagedatas[ texture.id ] === undefined ) { |
| 12266 | |
| 12267 | var canvas = document.createElement( 'canvas' ) |
| 12268 | canvas.width = texture.image.width; |
| 12269 | canvas.height = texture.image.height; |
| 12270 | |
| 12271 | var context = canvas.getContext( '2d' ); |
| 12272 | context.drawImage( texture.image, 0, 0 ); |
| 12273 | |
| 12274 | _imagedatas[ texture.id ] = context.getImageData( 0, 0, texture.image.width, texture.image.height ).data; |
| 12275 | |
| 12276 | // variables cannot be deleted in ES5 strict mode |
| 12277 | //delete canvas; |
| 12278 |
no test coverage detected