src/serialize.cc
branchpyrit
changeset 91 9d66d323c354
parent 80 907929fa9b59
child 95 ca7d4c665531
equal deleted inserted replaced
90:f6a72eb99631 91:9d66d323c354
    66 		trim(s);
    66 		trim(s);
    67 
    67 
    68 		// Vertex
    68 		// Vertex
    69 		if (s.compare("(v") == 0)
    69 		if (s.compare("(v") == 0)
    70 		{
    70 		{
    71 			Vector3 P;
    71 			Vector P;
    72 			st >> P;
    72 			st >> P;
    73 			getline(st, s, ')');
    73 			getline(st, s, ')');
    74 			vertices.push_back(new Vertex(P));
    74 			vertices.push_back(new Vertex(P));
    75 			getline(st, s, ',');
    75 			getline(st, s, ',');
    76 			continue;
    76 			continue;
    77 		}
    77 		}
    78 
    78 
    79 		// NormalVertex
    79 		// NormalVertex
    80 		if (s.compare("(vn") == 0)
    80 		if (s.compare("(vn") == 0)
    81 		{
    81 		{
    82 			Vector3 P,N;
    82 			Vector P,N;
    83 			st >> P;
    83 			st >> P;
    84 			getline(st, s, ',');
    84 			getline(st, s, ',');
    85 			st >> N;
    85 			st >> N;
    86 			getline(st, s, ')');
    86 			getline(st, s, ')');
    87 			vertices.push_back(new NormalVertex(P,N));
    87 			vertices.push_back(new NormalVertex(P,N));
   103 		}
   103 		}
   104 
   104 
   105 		// box
   105 		// box
   106 		if (s.compare("(box") == 0)
   106 		if (s.compare("(box") == 0)
   107 		{
   107 		{
   108 			Vector3 L,H;
   108 			Vector L,H;
   109 			st >> L;
   109 			st >> L;
   110 			getline(st, s, ',');
   110 			getline(st, s, ',');
   111 			st >> H;
   111 			st >> H;
   112 			getline(st, s, ')');
   112 			getline(st, s, ')');
   113 			return new Box(L, H, mat);
   113 			return new Box(L, H, mat);
   114 		}
   114 		}
   115 
   115 
   116 		// Sphere
   116 		// Sphere
   117 		if (s.compare("(sphere") == 0)
   117 		if (s.compare("(sphere") == 0)
   118 		{
   118 		{
   119 			Vector3 center;
   119 			Vector center;
   120 			Float radius;
   120 			Float radius;
   121 			st >> center;
   121 			st >> center;
   122 			getline(st, s, ',');
   122 			getline(st, s, ',');
   123 			st >> radius;
   123 			st >> radius;
   124 			getline(st, s, ')');
   124 			getline(st, s, ')');