MCPcopy Index your code
hub / github.com/stemkoski/stemkoski.github.com / patternPath

Function patternPath

Three.js/js/Three56.js:14376–14468  ·  view source on GitHub ↗
( x0, y0, x1, y1, x2, y2, u0, v0, u1, v1, u2, v2, texture )

Source from the content-addressed store, hash-verified

14374 }
14375
14376 function patternPath( x0, y0, x1, y1, x2, y2, u0, v0, u1, v1, u2, v2, texture ) {
14377
14378 if ( texture instanceof THREE.DataTexture || texture.image === undefined || texture.image.width == 0 ) return;
14379
14380 if ( texture.needsUpdate === true ) {
14381
14382 var repeatX = texture.wrapS == THREE.RepeatWrapping;
14383 var repeatY = texture.wrapT == THREE.RepeatWrapping;
14384
14385 _patterns[ texture.id ] = _context.createPattern(
14386 texture.image, repeatX === true && repeatY === true
14387 ? 'repeat'
14388 : repeatX === true && repeatY === false
14389 ? 'repeat-x'
14390 : repeatX === false && repeatY === true
14391 ? 'repeat-y'
14392 : 'no-repeat'
14393 );
14394
14395 texture.needsUpdate = false;
14396
14397 }
14398
14399 _patterns[ texture.id ] === undefined
14400 ? setFillStyle( 'rgba(0,0,0,1)' )
14401 : setFillStyle( _patterns[ texture.id ] );
14402
14403 // http://extremelysatisfactorytotalitarianism.com/blog/?p=2120
14404
14405 var a, b, c, d, e, f, det, idet,
14406 offsetX = texture.offset.x / texture.repeat.x,
14407 offsetY = texture.offset.y / texture.repeat.y,
14408 width = texture.image.width * texture.repeat.x,
14409 height = texture.image.height * texture.repeat.y;
14410
14411 u0 = ( u0 + offsetX ) * width;
14412 v0 = ( 1.0 - v0 + offsetY ) * height;
14413
14414 u1 = ( u1 + offsetX ) * width;
14415 v1 = ( 1.0 - v1 + offsetY ) * height;
14416
14417 u2 = ( u2 + offsetX ) * width;
14418 v2 = ( 1.0 - v2 + offsetY ) * height;
14419
14420 x1 -= x0; y1 -= y0;
14421 x2 -= x0; y2 -= y0;
14422
14423 u1 -= u0; v1 -= v0;
14424 u2 -= u0; v2 -= v0;
14425
14426 det = u1 * v2 - u2 * v1;
14427
14428 if ( det === 0 ) {
14429
14430 if ( _imagedatas[ texture.id ] === undefined ) {
14431
14432 var canvas = document.createElement( 'canvas' )
14433 canvas.width = texture.image.width;

Callers 1

renderFace3Function · 0.70

Calls 2

setFillStyleFunction · 0.70
fillPathFunction · 0.70

Tested by

no test coverage detected