( x0, y0, x1, y1, x2, y2, u0, v0, u1, v1, u2, v2, texture )
| 16923 | } |
| 16924 | |
| 16925 | function patternPath( x0, y0, x1, y1, x2, y2, u0, v0, u1, v1, u2, v2, texture ) { |
| 16926 | |
| 16927 | if ( texture instanceof THREE.DataTexture ) return; |
| 16928 | |
| 16929 | if ( texture.hasEventListener( 'update', onTextureUpdate ) === false ) { |
| 16930 | |
| 16931 | if ( texture.image !== undefined && texture.image.width > 0 ) { |
| 16932 | |
| 16933 | textureToPattern( texture ); |
| 16934 | |
| 16935 | } |
| 16936 | |
| 16937 | texture.addEventListener( 'update', onTextureUpdate ); |
| 16938 | |
| 16939 | } |
| 16940 | |
| 16941 | var pattern = _patterns[ texture.id ]; |
| 16942 | |
| 16943 | if ( pattern !== undefined ) { |
| 16944 | |
| 16945 | setFillStyle( pattern ); |
| 16946 | |
| 16947 | } else { |
| 16948 | |
| 16949 | setFillStyle( 'rgba(0,0,0,1)' ); |
| 16950 | _context.fill(); |
| 16951 | |
| 16952 | return; |
| 16953 | |
| 16954 | } |
| 16955 | |
| 16956 | // http://extremelysatisfactorytotalitarianism.com/blog/?p=2120 |
| 16957 | |
| 16958 | var a, b, c, d, e, f, det, idet, |
| 16959 | offsetX = texture.offset.x / texture.repeat.x, |
| 16960 | offsetY = texture.offset.y / texture.repeat.y, |
| 16961 | width = texture.image.width * texture.repeat.x, |
| 16962 | height = texture.image.height * texture.repeat.y; |
| 16963 | |
| 16964 | u0 = ( u0 + offsetX ) * width; |
| 16965 | v0 = ( v0 + offsetY ) * height; |
| 16966 | |
| 16967 | u1 = ( u1 + offsetX ) * width; |
| 16968 | v1 = ( v1 + offsetY ) * height; |
| 16969 | |
| 16970 | u2 = ( u2 + offsetX ) * width; |
| 16971 | v2 = ( v2 + offsetY ) * height; |
| 16972 | |
| 16973 | x1 -= x0; y1 -= y0; |
| 16974 | x2 -= x0; y2 -= y0; |
| 16975 | |
| 16976 | u1 -= u0; v1 -= v0; |
| 16977 | u2 -= u0; v2 -= v0; |
| 16978 | |
| 16979 | det = u1 * v2 - u2 * v1; |
| 16980 | |
| 16981 | if ( det === 0 ) return; |
| 16982 |
no test coverage detected