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

Method Update

trinity/Particle/Tr2GpuSharedEmitter.cpp:110–147  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

108}
109
110void Tr2GpuSharedEmitter::Update( const UpdateArguments& arguments )
111{
112 if( !arguments.system )
113 {
114 m_previousTime = Be::Time( -1 );
115 return;
116 }
117 if( !m_enabled )
118 {
119 return;
120 }
121 const bool firstUpdate = m_previousTime == Be::Time( -1 );
122 float dt = firstUpdate ? 0 : TimeAsFloat( arguments.time - m_previousTime );
123 m_previousTime = arguments.time;
124 if( dt <= 0 && !firstUpdate )
125 {
126 return;
127 }
128
129 Vector3 position( XMVector3TransformCoord( m_position, arguments.parentTransform ) );
130 Vector3 velocity = Vector3( 0.f, 0.f, 0.f );
131 if( !firstUpdate )
132 {
133 velocity = ( position - m_prevPosition - arguments.originShift ) / dt;
134 }
135 else
136 {
137 m_prevPosition = position - arguments.originShift;
138 }
139
140 if( m_continuousEmitter )
141 {
142 m_carryOver = SpawnParticles( m_emitter, arguments, m_prevPosition + arguments.originShift, position, m_prevVelocity, velocity, m_carryOver, std::min( dt, MAXIMUM_FRAME_TIME ) );
143 }
144
145 m_prevPosition = position;
146 m_prevVelocity = velocity;
147}
148
149void Tr2GpuSharedEmitter::SpawnParticles( const UpdateArguments& arguments, const Vector3* position, const Vector3* velocity, float rateModifier )
150{

Callers

nothing calls this directly

Calls 1

Vector3Class · 0.50

Tested by

no test coverage detected