( v1, element, material )
| 15291 | } |
| 15292 | |
| 15293 | function renderParticle( v1, element, material ) { |
| 15294 | |
| 15295 | setOpacity( material.opacity ); |
| 15296 | setBlending( material.blending ); |
| 15297 | |
| 15298 | var width, height, scaleX, scaleY, |
| 15299 | bitmap, bitmapWidth, bitmapHeight; |
| 15300 | |
| 15301 | if ( material instanceof THREE.ParticleBasicMaterial ) { |
| 15302 | |
| 15303 | if ( material.map === null ) { |
| 15304 | |
| 15305 | scaleX = element.object.scale.x; |
| 15306 | scaleY = element.object.scale.y; |
| 15307 | |
| 15308 | // TODO: Be able to disable this |
| 15309 | |
| 15310 | scaleX *= element.scale.x * _canvasWidthHalf; |
| 15311 | scaleY *= element.scale.y * _canvasHeightHalf; |
| 15312 | |
| 15313 | _elemBox.min.set( v1.x - scaleX, v1.y - scaleY ); |
| 15314 | _elemBox.max.set( v1.x + scaleX, v1.y + scaleY ); |
| 15315 | |
| 15316 | if ( _clipBox.isIntersectionBox( _elemBox ) === false ) { |
| 15317 | |
| 15318 | _elemBox.makeEmpty(); |
| 15319 | return; |
| 15320 | |
| 15321 | } |
| 15322 | |
| 15323 | setFillStyle( material.color.getStyle() ); |
| 15324 | |
| 15325 | _context.save(); |
| 15326 | _context.translate( v1.x, v1.y ); |
| 15327 | _context.rotate( - element.rotation ); |
| 15328 | _context.scale( scaleX, scaleY ); |
| 15329 | _context.fillRect( -1, -1, 2, 2 ); |
| 15330 | _context.restore(); |
| 15331 | |
| 15332 | } else { |
| 15333 | |
| 15334 | bitmap = material.map.image; |
| 15335 | bitmapWidth = bitmap.width >> 1; |
| 15336 | bitmapHeight = bitmap.height >> 1; |
| 15337 | |
| 15338 | scaleX = element.scale.x * _canvasWidthHalf; |
| 15339 | scaleY = element.scale.y * _canvasHeightHalf; |
| 15340 | |
| 15341 | width = scaleX * bitmapWidth; |
| 15342 | height = scaleY * bitmapHeight; |
| 15343 | |
| 15344 | // TODO: Rotations break this... |
| 15345 | |
| 15346 | _elemBox.min.set( v1.x - width, v1.y - height ); |
| 15347 | _elemBox.max.set( v1.x + width, v1.y + height ); |
| 15348 | |
| 15349 | if ( _clipBox.isIntersectionBox( _elemBox ) === false ) { |
| 15350 |
no test coverage detected