void ParticleEffect::load(const ParticleEffectTypePtr& effectType)
{
    if(!effectType)
        stdext::throw_exception("effect type not found");

    for(const OTMLNodePtr& childNode : effectType->getNode()->children()) {
        if(childNode->tag() == "System") {
            ParticleSystemPtr system = ParticleSystemPtr(new ParticleSystem);
            system->load(childNode);
            m_systems.push_back(system);
        }
    }
}
Beispiel #2
0
bool ParticleManager::load(const std::string& filename)
{
    try {
        OTMLDocumentPtr doc = OTMLDocument::parse(filename);
        for(const OTMLNodePtr& node : doc->children()) {
            if(node->tag() == "ParticleSystem") {
                ParticleSystemPtr particleSystem = ParticleSystemPtr(new ParticleSystem);
                particleSystem->load(node);
                m_systems.push_back(particleSystem);
            }
        }
        return true;
    } catch(Exception& e) {
        logError("could not load particles: ", e.what());
        return false;
    }
}