( x0, y0, x1, y1, x2, y2, u0, v0, u1, v1, u2, v2, texture )
| 16024 | } |
| 16025 | |
| 16026 | function patternPath( x0, y0, x1, y1, x2, y2, u0, v0, u1, v1, u2, v2, texture ) { |
| 16027 | |
| 16028 | if ( texture instanceof THREE.DataTexture || texture.image === undefined || texture.image.width == 0 ) return; |
| 16029 | |
| 16030 | if ( texture.needsUpdate === true ) { |
| 16031 | |
| 16032 | var repeatX = texture.wrapS == THREE.RepeatWrapping; |
| 16033 | var repeatY = texture.wrapT == THREE.RepeatWrapping; |
| 16034 | |
| 16035 | _patterns[ texture.id ] = _context.createPattern( |
| 16036 | texture.image, repeatX === true && repeatY === true |
| 16037 | ? 'repeat' |
| 16038 | : repeatX === true && repeatY === false |
| 16039 | ? 'repeat-x' |
| 16040 | : repeatX === false && repeatY === true |
| 16041 | ? 'repeat-y' |
| 16042 | : 'no-repeat' |
| 16043 | ); |
| 16044 | |
| 16045 | texture.needsUpdate = false; |
| 16046 | |
| 16047 | } |
| 16048 | |
| 16049 | _patterns[ texture.id ] === undefined |
| 16050 | ? setFillStyle( 'rgba(0,0,0,1)' ) |
| 16051 | : setFillStyle( _patterns[ texture.id ] ); |
| 16052 | |
| 16053 | // http://extremelysatisfactorytotalitarianism.com/blog/?p=2120 |
| 16054 | |
| 16055 | var a, b, c, d, e, f, det, idet, |
| 16056 | offsetX = texture.offset.x / texture.repeat.x, |
| 16057 | offsetY = texture.offset.y / texture.repeat.y, |
| 16058 | width = texture.image.width * texture.repeat.x, |
| 16059 | height = texture.image.height * texture.repeat.y; |
| 16060 | |
| 16061 | u0 = ( u0 + offsetX ) * width; |
| 16062 | v0 = ( 1.0 - v0 + offsetY ) * height; |
| 16063 | |
| 16064 | u1 = ( u1 + offsetX ) * width; |
| 16065 | v1 = ( 1.0 - v1 + offsetY ) * height; |
| 16066 | |
| 16067 | u2 = ( u2 + offsetX ) * width; |
| 16068 | v2 = ( 1.0 - v2 + offsetY ) * height; |
| 16069 | |
| 16070 | x1 -= x0; y1 -= y0; |
| 16071 | x2 -= x0; y2 -= y0; |
| 16072 | |
| 16073 | u1 -= u0; v1 -= v0; |
| 16074 | u2 -= u0; v2 -= v0; |
| 16075 | |
| 16076 | det = u1 * v2 - u2 * v1; |
| 16077 | |
| 16078 | if ( det === 0 ) { |
| 16079 | |
| 16080 | if ( _imagedatas[ texture.id ] === undefined ) { |
| 16081 | |
| 16082 | var canvas = document.createElement( 'canvas' ) |
| 16083 | canvas.width = texture.image.width; |
no test coverage detected