-----------------------------------------------------------------------------
| 197 | |
| 198 | // ----------------------------------------------------------------------------- |
| 199 | void EveChildParticleSphere::Update( const EveUpdateContext& updateContext ) |
| 200 | { |
| 201 | auto delta = updateContext.GetDeltaT(); |
| 202 | |
| 203 | auto originShift = updateContext.GetOriginShift(); |
| 204 | if( m_maxSpeed > 0.f && Length( originShift ) > m_maxSpeed * delta ) |
| 205 | { |
| 206 | originShift = Normalize( originShift ) * ( m_maxSpeed * delta ); |
| 207 | } |
| 208 | originShift *= m_movementScale; |
| 209 | |
| 210 | if( m_bindStatus == BIND_VALID ) |
| 211 | { |
| 212 | auto worldInv = Inverse( m_worldTransform ); |
| 213 | auto previousReferencePosition = TransformCoord( m_previousOrigin + originShift, worldInv ); |
| 214 | |
| 215 | auto shift = Length( TransformCoord( m_previousOrigin, worldInv ) ); |
| 216 | m_positionShift = shift; |
| 217 | auto positionShiftNormalized = std::min( std::max( ( m_positionShift - m_positionShiftMin ) / ( m_positionShiftMax - m_positionShiftMin ), 0.f ), 1.f ); |
| 218 | if( positionShiftNormalized < m_positionShiftNormalized ) |
| 219 | { |
| 220 | m_positionShiftNormalized = std::max( positionShiftNormalized, m_positionShiftNormalized - std::max( 0.f, delta * m_positionShiftDecreaseSpeed ) ); |
| 221 | } |
| 222 | else |
| 223 | { |
| 224 | m_positionShiftNormalized = std::min( positionShiftNormalized, m_positionShiftNormalized + std::max( 0.f, delta * m_positionShiftIncreaseSpeed ) ); |
| 225 | } |
| 226 | |
| 227 | ApplyConstraint( previousReferencePosition, Normalize( m_egoVelocity ) ); |
| 228 | AddParticles( previousReferencePosition, Normalize( m_egoVelocity ) ); |
| 229 | } |
| 230 | |
| 231 | m_previousOrigin = m_worldTransform.GetTranslation(); |
| 232 | |
| 233 | if( m_particleSystem ) |
| 234 | { |
| 235 | m_particleSystem->Update( ITr2GenericEmitter::UpdateArguments( |
| 236 | updateContext.GetTime(), |
| 237 | updateContext.GetGpuParticleSystem(), |
| 238 | IdentityMatrix(), |
| 239 | updateContext.GetOriginShift() ) ); |
| 240 | } |
| 241 | } |
| 242 | |
| 243 | // ----------------------------------------------------------------------------- |
| 244 | bool EveChildParticleSphere::CheckBinding() |
no test coverage detected