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

Function renderParticle

7DFPS/js/Three.js:15666–15779  ·  view source on GitHub ↗
( v1, element, material )

Source from the content-addressed store, hash-verified

15664 }
15665
15666 function renderParticle( v1, element, material ) {
15667
15668 setOpacity( material.opacity );
15669 setBlending( material.blending );
15670
15671 var width, height, scaleX, scaleY,
15672 bitmap, bitmapWidth, bitmapHeight;
15673
15674 if ( material instanceof THREE.ParticleBasicMaterial ) {
15675
15676 if ( material.map === null ) {
15677
15678 scaleX = element.object.scale.x;
15679 scaleY = element.object.scale.y;
15680
15681 // TODO: Be able to disable this
15682
15683 scaleX *= element.scale.x * _canvasWidthHalf;
15684 scaleY *= element.scale.y * _canvasHeightHalf;
15685
15686 _elemBox.min.set( v1.x - scaleX, v1.y - scaleY );
15687 _elemBox.max.set( v1.x + scaleX, v1.y + scaleY );
15688
15689 if ( _clipBox.isIntersectionBox( _elemBox ) === false ) {
15690
15691 _elemBox.makeEmpty();
15692 return;
15693
15694 }
15695
15696 setFillStyle( material.color.getStyle() );
15697
15698 _context.save();
15699 _context.translate( v1.x, v1.y );
15700 _context.rotate( - element.rotation );
15701 _context.scale( scaleX, scaleY );
15702 _context.fillRect( -1, -1, 2, 2 );
15703 _context.restore();
15704
15705 } else {
15706
15707 bitmap = material.map.image;
15708 bitmapWidth = bitmap.width >> 1;
15709 bitmapHeight = bitmap.height >> 1;
15710
15711 scaleX = element.scale.x * _canvasWidthHalf;
15712 scaleY = element.scale.y * _canvasHeightHalf;
15713
15714 width = scaleX * bitmapWidth;
15715 height = scaleY * bitmapHeight;
15716
15717 // TODO: Rotations break this...
15718
15719 _elemBox.min.set( v1.x - width, v1.y - height );
15720 _elemBox.max.set( v1.x + width, v1.y + height );
15721
15722 if ( _clipBox.isIntersectionBox( _elemBox ) === false ) {
15723

Callers 1

Three.jsFile · 0.70

Calls 4

setOpacityFunction · 0.70
setBlendingFunction · 0.70
setFillStyleFunction · 0.70
setStrokeStyleFunction · 0.70

Tested by

no test coverage detected