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

Method Rebind

trinity/Particle/Tr2DynamicEmitter.cpp:229–257  ·  view source on GitHub ↗

-------------------------------------------------------------------------------------- Description: Re-binds the emitter to its particle system. Tries to bind each generator to the corresponding element. IsValid can be checked after Rebind to see if the binding succeeded. --------------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

227// succeeded.
228// --------------------------------------------------------------------------------------
229void Tr2DynamicEmitter::Rebind()
230{
231 m_emittedParticles = 0;
232 m_isValid = false;
233 if( m_particleSystem == nullptr )
234 {
235 return;
236 }
237 const Tr2ParticleElementDataMap& declaration = m_particleSystem->GetElementDeclaration();
238
239 std::set<Tr2ParticleElementDeclarationName> boundElements;
240 for( auto it = m_generators.begin(); it != m_generators.end(); ++it )
241 {
242 if( !( *it )->Bind( declaration, boundElements ) )
243 {
244 return;
245 }
246 }
247 for( auto it = declaration.begin(); it != declaration.end(); ++it )
248 {
249 if( boundElements.find( it->first ) == boundElements.end() )
250 {
251 CCP_LOGERR( "Unbound particle element %s in a particle emitter", it->first.GetName().c_str() );
252 return;
253 }
254 }
255 m_isValid = true;
256 m_declarationHash = m_particleSystem->GetElementDeclarationHash();
257}
258
259// --------------------------------------------------------------------------------------
260// Description:

Callers

nothing calls this directly

Calls 5

beginMethod · 0.45
endMethod · 0.45
BindMethod · 0.45
GetNameMethod · 0.45

Tested by

no test coverage detected