MCPcopy Create free account
hub / github.com/admtrv/objcurses / parse_current_material

Method parse_current_material

entities/geometry/object.cpp:185–200  ·  view source on GitHub ↗

parse newmtl

Source from the content-addressed store, hash-verified

183
184// parse newmtl
185bool Object::parse_current_material(const std::string &line, std::string &current_name, Vec3 &current_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
203bool Object::parse_diffuse_color(const std::string &line, Vec3 &current_diffuse)

Callers

nothing calls this directly

Calls 1

Vec3Class · 0.85

Tested by

no test coverage detected