MCPcopy Create free account
hub / github.com/carbonengine/trinity / Update

Method Update

trinity/Eve/SpaceObject/Children/EveChildParticleSphere.cpp:199–241  ·  view source on GitHub ↗

-----------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

197
198// -----------------------------------------------------------------------------
199void 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// -----------------------------------------------------------------------------
244bool EveChildParticleSphere::CheckBinding()

Callers 8

UpdateSyncronousMethod · 0.45
DoUpdateAsyncronousMethod · 0.45
UpdateCurveSetMethod · 0.45
UpdateAsyncronousMethod · 0.45
UpdateAsyncronousMethod · 0.45
UpdateAsyncronousMethod · 0.45
UpdateSyncronousMethod · 0.45
UpdateSyncronousMethod · 0.45

Calls 7

LengthFunction · 0.85
ApplyConstraintFunction · 0.85
GetDeltaTMethod · 0.80
GetOriginShiftMethod · 0.80
GetTranslationMethod · 0.80
GetGpuParticleSystemMethod · 0.80
GetTimeMethod · 0.45

Tested by

no test coverage detected