parse newmtl
| 183 | |
| 184 | // parse newmtl |
| 185 | bool Object::parse_current_material(const std::string &line, std::string ¤t_name, Vec3 ¤t_diffuse, bool &have_active_material) |
| 186 | { |
| 187 | if (have_active_material) |
| 188 | { |
| 189 | materials.emplace_back(current_name, current_diffuse); |
| 190 | } |
| 191 | |
| 192 | if (std::stringstream ss(line); !(ss >> current_name)) |
| 193 | { |
| 194 | std::cerr << "error: can't parse material name" << std::endl; |
| 195 | return false; |
| 196 | }; |
| 197 | current_diffuse = Vec3(1.0f, 1.0f, 1.0f); |
| 198 | have_active_material = true; |
| 199 | return true; |
| 200 | } |
| 201 | |
| 202 | // parse kd |
| 203 | bool Object::parse_diffuse_color(const std::string &line, Vec3 ¤t_diffuse) |