void CEffectManager::Load(const std::string &Filename) { CXMLTreeNode l_XML; if (l_XML.LoadFile(Filename.c_str())) { CXMLTreeNode l_Effects = l_XML["effects"]; if (l_Effects.Exists()) { for (int i = 0; i < l_Effects.GetNumChildren(); ++i) { CXMLTreeNode l_Effect = l_Effects(i); if (l_Effect.GetName() == std::string("effect_technique")) { CEffectTechnique * Effect = new CEffectTechnique(l_Effect); AddResource(Effect->GetName(), Effect); } else if (l_Effect.GetName() == std::string("vertex_shader")) { CEffectVertexShader * Effect = new CEffectVertexShader(l_Effect); m_VertexShaders.AddResource(Effect->GetName(), Effect); } else if (l_Effect.GetName() == std::string("pixel_shader")) { CEffectPixelShader * Effect = new CEffectPixelShader(l_Effect); m_PixelShaders.AddResource(Effect->GetName(), Effect); } } } } }
void CEffectManager::load(const std::string &Filename) { CXMLTreeNode l_XML; if (l_XML.LoadFile(Filename.c_str())) { m_FileName = Filename; CXMLTreeNode l_Effects = l_XML["effects"]; if (l_Effects.Exists()) { for (int i = 0; i < l_Effects.GetNumChildren(); ++i) { CXMLTreeNode l_Effect = l_Effects(i); if (l_Effect.GetName() == std::string("effect_technique")) { CEffectTechnique * Effect = new CEffectTechnique(l_Effect); add(Effect->getName(), Effect); } else if (l_Effect.GetName() == std::string("vertex_shader")) { CEffectVertexShader * Effect = new CEffectVertexShader(l_Effect); bool success = Effect->Load(); if (success) { m_VertexShaders.add(Effect->getName(), Effect); } else { delete Effect; } } else if (l_Effect.GetName() == std::string("pixel_shader")) { CEffectPixelShader * Effect = new CEffectPixelShader(l_Effect); bool success = Effect->Load(); if (success) { m_PixelShaders.add(Effect->getName(), Effect); } else { delete Effect; } } else if (l_Effect.GetName() == std::string("geometry_shader")) { CEffectGeometryShader * Effect = new CEffectGeometryShader(l_Effect); bool success = Effect->Load(); if (success) { m_GeometryShaders.add(Effect->getName(), Effect); } else { delete Effect; } } } } } }