提交 59a3c4ff 编写于 作者: M Mr.doob

Merge pull request #7644 from tanquetav/dev

Enable interpret and generate tag 'd' 
......@@ -312,9 +312,14 @@ struct Material {
std::string name;
float Kd[3];
std::string map_Kd;
std::string d;
void DumpJson(FILE* out = stdout) const {
fprintf(out, " \"%s\": { ", name.c_str());
if (!d.empty()) {
fprintf(out, "\"d\": %s ,", d.c_str());
}
if (map_Kd.empty()) {
fprintf(out, "\"Kd\": [%hu, %hu, %hu] }",
Quantize(Kd[0], 0, 1, 255),
......@@ -357,6 +362,9 @@ class WavefrontMtlFile {
case 'K':
ParseColor(line + 1, line_num);
break;
case 'd':
ParseD(line + 1, line_num);
break;
case 'm':
if (0 == strncmp(line + 1, "ap_Kd", 5)) {
ParseMapKd(line + 6, line_num);
......@@ -386,6 +394,9 @@ class WavefrontMtlFile {
break;
}
}
void ParseD(const char* line, unsigned int line_num) {
current_->d = StripLeadingWhitespace(line);
}
void ParseMapKd(const char* line, unsigned int line_num) {
current_->map_Kd = StripLeadingWhitespace(line);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册