| 2527 | /// and be emitted at the given offset from the contact point having a direction of 'axis'. |
| 2528 | |
| 2529 | void ShapeBase::emitDust( ParticleEmitter* emitter, F32 triggerHeight, const Point3F& offset, U32 numMilliseconds, const Point3F& axis ) |
| 2530 | { |
| 2531 | if( !emitter ) |
| 2532 | return; |
| 2533 | |
| 2534 | Point3F startPos = getPosition(); |
| 2535 | Point3F endPos = startPos + Point3F( 0.0, 0.0, - triggerHeight ); |
| 2536 | |
| 2537 | RayInfo rayInfo; |
| 2538 | if( getContainer()->castRay( startPos, endPos, STATIC_COLLISION_TYPEMASK, &rayInfo ) ) |
| 2539 | { |
| 2540 | Material* material = ( rayInfo.material ? dynamic_cast< Material* >( rayInfo.material->getMaterial() ) : 0 ); |
| 2541 | if( material && material->mShowDust ) |
| 2542 | { |
| 2543 | LinearColorF colorList[ ParticleData::PDC_NUM_KEYS ]; |
| 2544 | |
| 2545 | for( U32 x = 0; x < getMin( Material::NUM_EFFECT_COLOR_STAGES, ParticleData::PDC_NUM_KEYS ); ++ x ) |
| 2546 | colorList[ x ] = material->mEffectColor[ x ]; |
| 2547 | for( U32 x = Material::NUM_EFFECT_COLOR_STAGES; x < ParticleData::PDC_NUM_KEYS; ++ x ) |
| 2548 | colorList[ x ].set( 1.0, 1.0, 1.0, 0.0 ); |
| 2549 | |
| 2550 | emitter->setColors( colorList ); |
| 2551 | |
| 2552 | Point3F contactPoint = rayInfo.point + offset; |
| 2553 | emitter->emitParticles( contactPoint, true, ( axis == Point3F::Zero ? rayInfo.normal : axis ), |
| 2554 | getVelocity(), numMilliseconds ); |
| 2555 | } |
| 2556 | } |
| 2557 | } |
| 2558 | |
| 2559 | //---------------------------------------------------------------------------- |
| 2560 |
nothing calls this directly
no test coverage detected