Add loading of alpha and emissive materials

pull/289/head
diiigle 2014-01-06 13:24:56 +01:00
parent 4913aefe5f
commit 89cfd47bdf
1 changed files with 14 additions and 2 deletions

View File

@ -178,8 +178,20 @@ void LDrawImporter::ReadMaterials(std::string filename){
edge.b = HexOctetToDecimal(cmd); edge.b = HexOctetToDecimal(cmd);
cmd += 2; cmd += 2;
edge = edge * (1 / 255.0f); edge = edge * (1 / 255.0f);
//TODO ALPHA and LUMINANCE
LDrawMaterial mat = LDrawMaterial(name, code, value, edge); LDrawMaterial mat = LDrawMaterial(name, code, value, edge);
SkipSpaces(&cmd);
if (TokenMatchI(cmd, "alpha", 5)){
SkipSpaces(&cmd);
unsigned int al = strtoul10(cmd, &cmd);
mat.alpha = float(al) / 255.0f;
}
SkipSpaces(&cmd);
if (TokenMatchI(cmd, "luminance", 9)){
SkipSpaces(&cmd);
unsigned int l = strtoul10(cmd, &cmd);
mat.luminance = float(l) / 255.0f;
}
materials.insert(std::pair<ColorIndex, LDrawMaterial>(code, mat)); materials.insert(std::pair<ColorIndex, LDrawMaterial>(code, mat));
} }
} }