( v1, element, material )
| 13837 | } |
| 13838 | |
| 13839 | function renderParticle( v1, element, material ) { |
| 13840 | |
| 13841 | setOpacity( material.opacity ); |
| 13842 | setBlending( material.blending ); |
| 13843 | |
| 13844 | var width, height, scaleX, scaleY, |
| 13845 | bitmap, bitmapWidth, bitmapHeight; |
| 13846 | |
| 13847 | if ( material instanceof THREE.ParticleBasicMaterial ) { |
| 13848 | |
| 13849 | if ( material.map === null ) { |
| 13850 | |
| 13851 | scaleX = element.object.scale.x; |
| 13852 | scaleY = element.object.scale.y; |
| 13853 | |
| 13854 | // TODO: Be able to disable this |
| 13855 | |
| 13856 | scaleX *= element.scale.x * _canvasWidthHalf; |
| 13857 | scaleY *= element.scale.y * _canvasHeightHalf; |
| 13858 | |
| 13859 | _elemBox.min.set( v1.x - scaleX, v1.y - scaleY ); |
| 13860 | _elemBox.max.set( v1.x + scaleX, v1.y + scaleY ); |
| 13861 | |
| 13862 | if ( _clipBox.isIntersectionBox( _elemBox ) === false ) { |
| 13863 | |
| 13864 | return; |
| 13865 | |
| 13866 | } |
| 13867 | |
| 13868 | setFillStyle( material.color.getStyle() ); |
| 13869 | |
| 13870 | _context.save(); |
| 13871 | _context.translate( v1.x, v1.y ); |
| 13872 | _context.rotate( - element.rotation ); |
| 13873 | _context.scale( scaleX, scaleY ); |
| 13874 | _context.fillRect( -1, -1, 2, 2 ); |
| 13875 | _context.restore(); |
| 13876 | |
| 13877 | } else { |
| 13878 | |
| 13879 | bitmap = material.map.image; |
| 13880 | bitmapWidth = bitmap.width >> 1; |
| 13881 | bitmapHeight = bitmap.height >> 1; |
| 13882 | |
| 13883 | scaleX = element.scale.x * _canvasWidthHalf; |
| 13884 | scaleY = element.scale.y * _canvasHeightHalf; |
| 13885 | |
| 13886 | width = scaleX * bitmapWidth; |
| 13887 | height = scaleY * bitmapHeight; |
| 13888 | |
| 13889 | // TODO: Rotations break this... |
| 13890 | |
| 13891 | _elemBox.min.set( v1.x - width, v1.y - height ); |
| 13892 | _elemBox.max.set( v1.x + width, v1.y + height ); |
| 13893 | |
| 13894 | if ( _clipBox.isIntersectionBox( _elemBox ) === false ) { |
| 13895 | |
| 13896 | return; |
no test coverage detected