-------------------------------------------------------------------------------------- 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. --------------------------------------------------------------------------------------
| 227 | // succeeded. |
| 228 | // -------------------------------------------------------------------------------------- |
| 229 | void 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: |
nothing calls this directly
no test coverage detected