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

Function renderParticle

Three.js/js/ThreeDebug.js:9466–9548  ·  view source on GitHub ↗
( v1, element, material, scene )

Source from the content-addressed store, hash-verified

9464 }
9465
9466 function renderParticle ( v1, element, material, scene ) {
9467
9468 setOpacity( material.opacity );
9469 setBlending( material.blending );
9470
9471 var width, height, scaleX, scaleY,
9472 bitmap, bitmapWidth, bitmapHeight;
9473
9474 if ( material instanceof THREE.ParticleBasicMaterial ) {
9475
9476 if ( material.map ) {
9477
9478 bitmap = material.map.image;
9479 bitmapWidth = bitmap.width >> 1;
9480 bitmapHeight = bitmap.height >> 1;
9481
9482 scaleX = element.scale.x * _canvasWidthHalf;
9483 scaleY = element.scale.y * _canvasHeightHalf;
9484
9485 width = scaleX * bitmapWidth;
9486 height = scaleY * bitmapHeight;
9487
9488 // TODO: Rotations break this...
9489
9490 _bboxRect.set( v1.x - width, v1.y - height, v1.x + width, v1.y + height );
9491
9492 if ( !_clipRect.intersects( _bboxRect ) ) {
9493
9494 return;
9495
9496 }
9497
9498 _context.save();
9499 _context.translate( v1.x, v1.y );
9500 _context.rotate( - element.rotation );
9501 _context.scale( scaleX, - scaleY );
9502
9503 _context.translate( - bitmapWidth, - bitmapHeight );
9504 _context.drawImage( bitmap, 0, 0 );
9505
9506 _context.restore();
9507
9508 }
9509
9510
9511 _context.beginPath();
9512 _context.moveTo( v1.x - 10, v1.y );
9513 _context.lineTo( v1.x + 10, v1.y );
9514 _context.moveTo( v1.x, v1.y - 10 );
9515 _context.lineTo( v1.x, v1.y + 10 );
9516 _context.closePath();
9517 _context.strokeStyle = 'rgb(255,255,0)';
9518 _context.stroke();
9519
9520
9521 } else if ( material instanceof THREE.ParticleCanvasMaterial ) {
9522
9523 width = element.scale.x * _canvasWidthHalf;

Callers 1

ThreeDebug.jsFile · 0.70

Calls 4

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

Tested by

no test coverage detected