Esempio n. 1
0
void CCustomParser::parse(const std::string& filename) {
	std::ifstream in(filename);
	std::string s;
	while(std::getline(in, s)) {
		std::istringstream s_stream(s);
		std::string cur_s;
		s_stream >> cur_s;
		if(cur_s == "sphere") {
			double c_x, c_y, c_z, radius;
			int r, g, b;
			s_stream >> c_x >> c_y >> c_z >> radius;
			s_stream >> r >> g >> b;
			CMaterial mat;
			mat.set_color(CColor(r, g, b));
			CSphere* sphere = new CSphere(radius, CPoint3D(c_x, c_y, c_z), mat);
			m_objects.push_back(sphere);	
		}
		else if(cur_s == "camera") {