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

Function textureToPattern

Three.js/js/Three66.js:16898–16923  ·  view source on GitHub ↗
( texture )

Source from the content-addressed store, hash-verified

16896 }
16897
16898 function textureToPattern( texture ) {
16899
16900 var repeatX = texture.wrapS === THREE.RepeatWrapping;
16901 var repeatY = texture.wrapT === THREE.RepeatWrapping;
16902
16903 var image = texture.image;
16904
16905 var canvas = document.createElement( 'canvas' );
16906 canvas.width = image.width;
16907 canvas.height = image.height;
16908
16909 var context = canvas.getContext( '2d' );
16910 context.setTransform( 1, 0, 0, - 1, 0, image.height );
16911 context.drawImage( image, 0, 0 );
16912
16913 _patterns[ texture.id ] = _context.createPattern(
16914 canvas, repeatX === true && repeatY === true
16915 ? 'repeat'
16916 : repeatX === true && repeatY === false
16917 ? 'repeat-x'
16918 : repeatX === false && repeatY === true
16919 ? 'repeat-y'
16920 : 'no-repeat'
16921 );
16922
16923 }
16924
16925 function patternPath( x0, y0, x1, y1, x2, y2, u0, v0, u1, v1, u2, v2, texture ) {
16926

Callers 3

renderSpriteFunction · 0.85
onTextureUpdateFunction · 0.85
patternPathFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected