( v1, element, material )
| 15641 | } |
| 15642 | |
| 15643 | function renderParticle( v1, element, material ) { |
| 15644 | |
| 15645 | setOpacity( material.opacity ); |
| 15646 | setBlending( material.blending ); |
| 15647 | |
| 15648 | var width, height, scaleX, scaleY, |
| 15649 | bitmap, bitmapWidth, bitmapHeight; |
| 15650 | |
| 15651 | if ( material instanceof THREE.ParticleBasicMaterial ) { |
| 15652 | |
| 15653 | if ( material.map === null ) { |
| 15654 | |
| 15655 | scaleX = element.object.scale.x; |
| 15656 | scaleY = element.object.scale.y; |
| 15657 | |
| 15658 | // TODO: Be able to disable this |
| 15659 | |
| 15660 | scaleX *= element.scale.x * _canvasWidthHalf; |
| 15661 | scaleY *= element.scale.y * _canvasHeightHalf; |
| 15662 | |
| 15663 | _elemBox.min.set( v1.x - scaleX, v1.y - scaleY ); |
| 15664 | _elemBox.max.set( v1.x + scaleX, v1.y + scaleY ); |
| 15665 | |
| 15666 | if ( _clipBox.isIntersectionBox( _elemBox ) === false ) { |
| 15667 | |
| 15668 | _elemBox.makeEmpty(); |
| 15669 | return; |
| 15670 | |
| 15671 | } |
| 15672 | |
| 15673 | setFillStyle( material.color.getStyle() ); |
| 15674 | |
| 15675 | _context.save(); |
| 15676 | _context.translate( v1.x, v1.y ); |
| 15677 | _context.rotate( - element.rotation ); |
| 15678 | _context.scale( scaleX, scaleY ); |
| 15679 | _context.fillRect( -1, -1, 2, 2 ); |
| 15680 | _context.restore(); |
| 15681 | |
| 15682 | } else { |
| 15683 | |
| 15684 | bitmap = material.map.image; |
| 15685 | bitmapWidth = bitmap.width >> 1; |
| 15686 | bitmapHeight = bitmap.height >> 1; |
| 15687 | |
| 15688 | scaleX = element.scale.x * _canvasWidthHalf; |
| 15689 | scaleY = element.scale.y * _canvasHeightHalf; |
| 15690 | |
| 15691 | width = scaleX * bitmapWidth; |
| 15692 | height = scaleY * bitmapHeight; |
| 15693 | |
| 15694 | // TODO: Rotations break this... |
| 15695 | |
| 15696 | _elemBox.min.set( v1.x - width, v1.y - height ); |
| 15697 | _elemBox.max.set( v1.x + width, v1.y + height ); |
| 15698 | |
| 15699 | if ( _clipBox.isIntersectionBox( _elemBox ) === false ) { |
| 15700 |
no test coverage detected