<commit_before>#include "scene.hpp"

Scene loadSDF(std::string const& filename)
{
  Scene scene;
  std::map<std::string,std::shared_ptr<Shape>> tmp_shapes;
  

  std::ifstream file;
  file.open(filename);
  std::string line;
    if(file.is_open())
    {
      while(std::getline(file, line))
      {
        Material mat;

        std::stringstream ss;
        std::string keyword;

        ss<<line;
        ss>>keyword;
        if (keyword == "define")
        {
          ss>>keyword;
          if (keyword == "material")
          {
            ss>>mat.name_;
            ss>>mat.ka_.r;
            ss>>mat.ka_.g;
            ss>>mat.ka_.b;
            ss>>mat.kd_.r;
            ss>>mat.kd_.g;
            ss>>mat.kd_.b;
            ss>>mat.ks_.r;
            ss>>mat.ks_.g;
            ss>>mat.ks_.b;
            ss>>mat.m_;

            scene.materials[mat.name_]= mat;
            std::cout << "another material added to scene...\n";
          }
          if (keyword == "shape")
          {
            ss>>keyword;
            if (keyword =="box")
            {
              std::string name,color;
              glm::vec3 min, max;

              ss>>name;
              ss>>min.x;
              ss>>min.y;
              ss>>min.z;
              ss>>max.x;
              ss>>max.y;
              ss>>max.z;
              ss>>color;

              //std::cout << box << std::endl;
              std::shared_ptr<Shape> box0 = std::make_shared<Box> (scene.materials[color],name,min,max);
              tmp_shapes[name] = box0;
              std::cout << "another box added to scene...\n";
            }
            if (keyword == "sphere")
            {
              std::string name, color;
              glm::vec3 middlpt;
              float r;

              ss>>name;
              ss>>middlpt.x;
              ss>>middlpt.y;
              ss>>middlpt.z;
              ss>>r;
              ss>>color;

              std::shared_ptr<Shape> sphere0 = std::make_shared<Sphere> (scene.materials[color],name,
                middlpt,r);
              tmp_shapes[name] = sphere0;
              std::cout << "another sphere added to scene...\n";
            }
            if (keyword == "composite")
            {
              std::string name, shape1, shape2;

              ss>>name;
              ss>>shape1;
              ss>>shape2;

              std::shared_ptr<Composite> comp0 = std::make_shared<Composite> (name);
              comp0->add_shape(tmp_shapes[shape1]);
              comp0->add_shape(tmp_shapes[shape2]);
              scene.shapes.push_back(comp0);
            }
          }


          if (keyword == "camera")
          {
            ss>>scene.camera.name_;
            ss>>scene.camera.fov_x_;
            ss>>scene.camera.origin_.x;
            ss>>scene.camera.origin_.y;
            ss>>scene.camera.origin_.z;<commit_msg>in scene wird jetzt die box zu composite hinzugefuegt<commit_after>#include "scene.hpp"

Scene loadSDF(std::string const& filename)
{
  Scene scene;
  std::map<std::string,std::shared_ptr<Shape>> tmp_shapes;
  

  std::ifstream file;
  file.open(filename);
  std::string line;
    if(file.is_open())
    {
      while(std::getline(file, line))
      {
        Material mat;

        std::stringstream ss;
        std::string keyword;

        ss<<line;
        ss>>keyword;
        if (keyword == "define")
        {
          ss>>keyword;
          if (keyword == "material")
          {
            ss>>mat.name_;
            ss>>mat.ka_.r;
            ss>>mat.ka_.g;
            ss>>mat.ka_.b;
            ss>>mat.kd_.r;
            ss>>mat.kd_.g;
            ss>>mat.kd_.b;
            ss>>mat.ks_.r;
            ss>>mat.ks_.g;
            ss>>mat.ks_.b;
            ss>>mat.m_;

            scene.materials[mat.name_]= mat;
            std::cout << "another material added to scene...\n";
          }
          if (keyword == "shape")
          {
            ss>>keyword;
            if (keyword =="box")
            {
              std::string name,color;
              glm::vec3 min, max;

              ss>>name;
              ss>>min.x;
              ss>>min.y;
              ss>>min.z;
              ss>>max.x;
              ss>>max.y;
              ss>>max.z;
              ss>>color;

              //std::cout << box << std::endl;
              std::shared_ptr<Shape> box0 = std::make_shared<Box> (scene.materials[color],name,min,max);
              tmp_shapes[name] = box0;
              std::cout << "another box added to scene...\n";
            }
            if (keyword == "sphere")
            {
              std::string name, color;
              glm::vec3 middlpt;
              float r;

              ss>>name;
              ss>>middlpt.x;
              ss>>middlpt.y;
              ss>>middlpt.z;
              ss>>r;
              ss>>color;

              std::shared_ptr<Shape> sphere0 = std::make_shared<Sphere> (scene.materials[color],name,
                middlpt,r);
              tmp_shapes[name] = sphere0;
              std::cout << "another sphere added to scene...\n";
            }
            if (keyword == "composite")
            {
              std::string name, shape1, shape2, box0;

              ss>>name;
              ss>>shape1;
              ss>>shape2;
              ss>>box0;

              std::shared_ptr<Composite> comp0 = std::make_shared<Composite> (name);
              comp0->add_shape(tmp_shapes[shape1]);
              comp0->add_shape(tmp_shapes[shape2]);
              comp0->add_shape(tmp_shapes[box0]);
              scene.shapes.push_back(comp0);
            }
          }


          if (keyword == "camera")
          {
            ss>>scene.camera.name_;
            ss>>scene.camera.fov_x_;
            ss>>scene.camera.origin_.x;
            ss>>scene.camera.origin_.y;
            ss>>scene.camera.origin_.z;
{'fraction_non_alphanumeric': 0.1422458062307429, 'fraction_numerical': 0.0061622731941116055, 'mean_word_length': 1.2850997262416894, 'pattern_counts': {'":': 0, '<': 43, '<?xml version=': 0, '>': 170, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '308586', 'n_tokens_mistral': 1810, 'n_tokens_neox': 1760, 'n_words': 292}