std::list<std::shared_ptr<I_Object>> SceneSettingReader::readObjects()
{
    std::list<std::shared_ptr<I_Object>> objects;
    settings_.beginGroup(OBJECTS_GROUP);
    const int size = settings_.beginReadArray("objects");
    for (int i = 0; i < size; ++i)
    {
        settings_.setArrayIndex(i);
        if (settings_.value("type").toString() == "sphere")
        {
            objects.push_back(std::shared_ptr<I_Object>(readSphere()));
        }
        else if (settings_.value("type").toString() == "triangle")
        {
            objects.push_back(std::shared_ptr<I_Object>(readTriangle()));
        }
        else if (settings_.value("type").toString() == "quad")
        {
            objects.push_back(std::shared_ptr<I_Object>(readQuad()));
        }
        else if (settings_.value("type").toString() == "model")
        {
            objects.push_back(std::shared_ptr<I_Object>(readModel()));
        }
        else
        {
            std::cout << "Error: object type is not valid"
                << settings_.value("type").toString().toStdString() << std::endl;
        }
    }
    settings_.endArray();
    settings_.endGroup();
    return objects;
}
ShapePointer SceneLoader::readShape(const QDomElement &element) const {
  QString shapeType;
  if (!readAttributeAsString(element, "type", shapeType)) {
    return ShapePointer(NULL);
  }

  MaterialPointer shapeMaterial = readMaterial(element);
  if (shapeMaterial == NULL) {
    return ShapePointer(NULL);
  }

  if (shapeType == "plane") {
    return readPlane(element, shapeMaterial);
  }
  if (shapeType == "sphere") {
    return readSphere(element, shapeMaterial);
  }
  if (shapeType == "cylinder") {
    return readCylinder(element, shapeMaterial);
  }
  if (shapeType == "cone") {
    return readCone(element, shapeMaterial);
  }
  if (shapeType == "triangle") {
    return readTriangle(element, shapeMaterial);
  }
  if (shapeType == "box") {
    return readBox(element, shapeMaterial);
  }
  if (shapeType == "torus") {
    return readTorus(element, shapeMaterial);
  }
  if (shapeType == "model") {
    return readMeshModel(element, shapeMaterial);
  }

  std::cerr << "Scene parsing error: unknown shape type '" << shapeType.toUtf8().constData() << "'" << std::endl;
  return ShapePointer(NULL);
}