( x0, y0, x1, y1, x2, y2, u0, v0, u1, v1, u2, v2, texture )
| 16217 | } |
| 16218 | |
| 16219 | function patternPath( x0, y0, x1, y1, x2, y2, u0, v0, u1, v1, u2, v2, texture ) { |
| 16220 | |
| 16221 | if ( texture instanceof THREE.DataTexture || texture.image === undefined || texture.image.width == 0 ) return; |
| 16222 | |
| 16223 | if ( texture.needsUpdate === true ) { |
| 16224 | |
| 16225 | var repeatX = texture.wrapS == THREE.RepeatWrapping; |
| 16226 | var repeatY = texture.wrapT == THREE.RepeatWrapping; |
| 16227 | |
| 16228 | _patterns[ texture.id ] = _context.createPattern( |
| 16229 | texture.image, repeatX === true && repeatY === true |
| 16230 | ? 'repeat' |
| 16231 | : repeatX === true && repeatY === false |
| 16232 | ? 'repeat-x' |
| 16233 | : repeatX === false && repeatY === true |
| 16234 | ? 'repeat-y' |
| 16235 | : 'no-repeat' |
| 16236 | ); |
| 16237 | |
| 16238 | texture.needsUpdate = false; |
| 16239 | |
| 16240 | } |
| 16241 | |
| 16242 | _patterns[ texture.id ] === undefined |
| 16243 | ? setFillStyle( 'rgba(0,0,0,1)' ) |
| 16244 | : setFillStyle( _patterns[ texture.id ] ); |
| 16245 | |
| 16246 | // http://extremelysatisfactorytotalitarianism.com/blog/?p=2120 |
| 16247 | |
| 16248 | var a, b, c, d, e, f, det, idet, |
| 16249 | offsetX = texture.offset.x / texture.repeat.x, |
| 16250 | offsetY = texture.offset.y / texture.repeat.y, |
| 16251 | width = texture.image.width * texture.repeat.x, |
| 16252 | height = texture.image.height * texture.repeat.y; |
| 16253 | |
| 16254 | u0 = ( u0 + offsetX ) * width; |
| 16255 | v0 = ( 1.0 - v0 + offsetY ) * height; |
| 16256 | |
| 16257 | u1 = ( u1 + offsetX ) * width; |
| 16258 | v1 = ( 1.0 - v1 + offsetY ) * height; |
| 16259 | |
| 16260 | u2 = ( u2 + offsetX ) * width; |
| 16261 | v2 = ( 1.0 - v2 + offsetY ) * height; |
| 16262 | |
| 16263 | x1 -= x0; y1 -= y0; |
| 16264 | x2 -= x0; y2 -= y0; |
| 16265 | |
| 16266 | u1 -= u0; v1 -= v0; |
| 16267 | u2 -= u0; v2 -= v0; |
| 16268 | |
| 16269 | det = u1 * v2 - u2 * v1; |
| 16270 | |
| 16271 | if ( det === 0 ) { |
| 16272 | |
| 16273 | if ( _imagedatas[ texture.id ] === undefined ) { |
| 16274 | |
| 16275 | var canvas = document.createElement( 'canvas' ) |
| 16276 | canvas.width = texture.image.width; |
no test coverage detected